More actions
imported>novaman No edit summary |
(Repair batch-0003 pages from live compare) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 1: | Line 1: | ||
== Status == | |||
{| class="wikitable" style="width:100%;" | |||
|- | |||
| Problem | |||
| 1298 | |||
| User | |||
| finchpark | |||
|- | |||
| Memory | |||
| 224K | |||
| Time | |||
| 0MS | |||
|- | |||
| Language | |||
| C++ | |||
| Result | |||
| Accepted | |||
|} | |||
== Source == | |||
#include <iostream> | #include <iostream> | ||
#include <string> | #include <string> | ||
| Line 24: | Line 44: | ||
if(input == "START") | if(input == "START") | ||
{ | { | ||
getline(cin, inputChiper | getline(cin, inputChiper[i]); | ||
getline(cin, end); | getline(cin, end); | ||
count++; | count++; | ||
| Line 36: | Line 56: | ||
for(int i = 0; i < count; i++) | for(int i = 0; i < count; i++) | ||
printDecipher(inputChiper | printDecipher(inputChiper[i]); | ||
return 0; | return 0; | ||
| Line 47: | Line 67: | ||
for(int i = 0; i < chiper.size(); i++) | for(int i = 0; i < chiper.size(); i++) | ||
{ | { | ||
int chip = (int)chiper | int chip = (int)chiper[i]; | ||
if((chip >= 65) && (chip <= 69)) | if((chip >= 65) && (chip <= 69)) | ||
print | print[i] = (char)(chip + 21); | ||
else if((chip >= 70) && (chip <= 90)) | else if((chip >= 70) && (chip <= 90)) | ||
print | print[i] = (char)(chip - 5); | ||
else | else | ||
print | print[i] = (char)chip; | ||
cout << print | 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;
}