Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

TheHardestProblemEver/권순의: Difference between revisions

From ZeroWiki
imported>novaman
No edit summary
(Repair batch-0003 pages from live compare)
 
Line 1: Line 1:
== Status ==
== Status ==
{| class="wikitable"
{| class="wikitable" style="width:100%;"
|-
|-
| Problem
| Problem
Line 44: Line 44:
  if(input == "START")
  if(input == "START")
  {
  {
  getline(cin, inputChiper[i]);
  getline(cin, inputChiper[i]);
  getline(cin, end);
  getline(cin, end);
  count++;
  count++;
Line 56: Line 56:
 
 
  for(int i = 0; i < count; i++)
  for(int i = 0; i < count; i++)
  printDecipher(inputChiper[i]);
  printDecipher(inputChiper[i]);
   
   
  return 0;
  return 0;
Line 67: Line 67:
  for(int i = 0; i < chiper.size(); i++)
  for(int i = 0; i < chiper.size(); i++)
  {
  {
  int chip = (int)chiper[i];
  int chip = (int)chiper[i];
   
   
  if((chip >= 65) && (chip <= 69))
  if((chip >= 65) && (chip <= 69))
  print[i] = (char)(chip + 21);
  print[i] = (char)(chip + 21);
  else if((chip >= 70) && (chip <= 90))
  else if((chip >= 70) && (chip <= 90))
  print[i] = (char)(chip - 5);
  print[i] = (char)(chip - 5);
  else
  else
  print[i] = (char)chip;
  print[i] = (char)chip;
 
 
  cout << print[i];
  cout << print[i];
  }
  }
  cout << endl;
  cout << endl;
  }
  }

Latest revision as of 00:29, 27 March 2026

Status

Problem 1298 User finchpark
Memory 224K Time 0MS
Language C++ Result Accepted

Source

#include <iostream>
#include <string>
#include <cstring>
#include <vector>

using namespace std;

void printDecipher(string chiper);

const int NUM = 200;

int main()
{
	vector<string> inputChiper(NUM);
	string decipher;
	string input;
	string end;
	int count = 0;

	for(int i = 0; i < 100; i++)
	{
		getline(cin, input);

		if(input == "START")
		{
			getline(cin, inputChiper[i]);
			getline(cin, end);
			count++;
		}else if(input == "ENDOFINPUT"){
			break;
		}else{
			cout << "Wrong input" << endl;
			exit(0);
		}
	}
	
	for(int i = 0; i < count; i++)
		printDecipher(inputChiper[i]);

	return 0;
}

void printDecipher(string chiper)
{
	vector<string> print(100);

	for(int i = 0; i < chiper.size(); i++)
	{
		int chip = (int)chiper[i];

		if((chip >= 65) && (chip <= 69))
			print[i] = (char)(chip + 21);
		else if((chip >= 70) && (chip <= 90))
			print[i] = (char)(chip - 5);
		else
			print[i] = (char)chip;
		
		cout << print[i];
	}
	cout << endl;
}