| Task: | Nimionese |
| Sender: | Game of Nolife |
| Submission time: | 2015-11-25 18:21:53 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.06 s | details |
| #2 | ACCEPTED | 0.05 s | details |
| #3 | ACCEPTED | 0.05 s | details |
| #4 | ACCEPTED | 0.05 s | details |
| #5 | ACCEPTED | 0.05 s | details |
| #6 | ACCEPTED | 0.05 s | details |
| #7 | ACCEPTED | 0.06 s | details |
| #8 | ACCEPTED | 0.05 s | details |
| #9 | ACCEPTED | 0.06 s | details |
| #10 | ACCEPTED | 0.06 s | details |
| #11 | ACCEPTED | 0.05 s | details |
| #12 | ACCEPTED | 0.05 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:37:7: warning: array subscript has type 'char' [-Wchar-subscripts]
hc[c]=1;
^
input/code.cpp:47:15: warning: array subscript has type 'char' [-Wchar-subscripts]
if (!hc[s[0]]){
^
input/code.cpp:53:22: warning: array subscript has type 'char' [-Wchar-subscripts]
if (ff==1&&hc[s[i]]){
^
input/code.cpp:57:23: warning: array subscript has type 'char' [-Wchar-subscripts]
if (hc[s[s.size()-1]]){
^Code
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef long double ld;
int hc[300];
vector<char> hcs;
char near(char t, vector<char>&f){
int b=100;
char r=0;
for (char c:f){
if (abs(c-t)<b){
b=abs(c-t);
r=c;
}
}
//cout<<b<<" "<<r<<" "<<t<<endl;
return r;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
hcs.push_back('b');
hcs.push_back('c');
hcs.push_back('d');
hcs.push_back('g');
hcs.push_back('k');
hcs.push_back('n');
hcs.push_back('p');
hcs.push_back('t');
vector<char> lol={'a', 'o', 'u'};
for (char c:hcs){
hc[c]=1;
}
string s;
while (cin>>s){
int si=0;
if (s[0]>='A'&&s[0]<='Z'){
si=1;
s[0]-='A';
s[0]+='a';
}
if (!hc[s[0]]){
s[0]=near(s[0], hcs);
}
int ff=0;
for (int i=1;i<(int)s.size();i++){
if (s[i]=='-') ff=1;
if (ff==1&&hc[s[i]]){
s[i]=s[0];
}
}
if (hc[s[s.size()-1]]){
char ad=near(s[s.size()-1], lol);
s+=ad;
s+='h';
}
if (si){
s[0]-='a';
s[0]+='A';
}
for (char c:s){
if (c!='-'){
cout<<c;
}
}
cout<<" ";
}
}Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| Each hip-po dog hip hip Hooray |
| correct output |
|---|
| Dach gipgo dogah gipoh gipoh G... |
| user output |
|---|
| Dach gipgo dogah gipoh gipoh G... |
Test 2
Verdict: ACCEPTED
| input |
|---|
| aa ab ac ad ae af ag ah ai aj ... |
| correct output |
|---|
| ba bbah bcah bdah be bf bgah b... |
| user output |
|---|
| ba bbah bcah bdah be bf bgah b... |
Test 3
Verdict: ACCEPTED
| input |
|---|
| axx bxx cxx dxx exx fxx gxx hx... |
| correct output |
|---|
| bxx bxx cxx dxx dxx gxx gxx gx... |
| user output |
|---|
| bxx bxx cxx dxx dxx gxx gxx gx... |
Test 4
Verdict: ACCEPTED
| input |
|---|
| bc-acb bd-adb bg-agb bk-akb bn... |
| correct output |
|---|
| bcabbah bdabbah bgabbah bkabba... |
| user output |
|---|
| bcabbah bdabbah bgabbah bkabba... |
Test 5
Verdict: ACCEPTED
| input |
|---|
| Hip-po Aip-pop cip-pop dip-pop... |
| correct output |
|---|
| Gipgo Bipbobah cipcocah dipdod... |
| user output |
|---|
| Gipgo Bipbobah cipcocah dipdod... |
Test 6
Verdict: ACCEPTED
| input |
|---|
| d d d d d d d d d d d d d d d ... |
| correct output |
|---|
| dah dah dah dah dah dah dah da... |
| user output |
|---|
| dah dah dah dah dah dah dah da... |
Test 7
Verdict: ACCEPTED
| input |
|---|
| Dad dad Dad dad dad dad dad da... |
| correct output |
|---|
| Dadah dadah Dadah dadah dadah ... |
| user output |
|---|
| Dadah dadah Dadah dadah dadah ... |
Test 8
Verdict: ACCEPTED
| input |
|---|
| dddddddddddddddddddddddddddddd... |
| correct output |
|---|
| dddddddddddddddddddddddddddddd... |
| user output |
|---|
| dddddddddddddddddddddddddddddd... |
Test 9
Verdict: ACCEPTED
| input |
|---|
| Wpgliaku-uibagddilpynomsytuubi... |
| correct output |
|---|
| Tpgliakuuitatttiltytomsytuutil... |
| user output |
|---|
| Tpgliakuuitatttiltytomsytuutil... |
Test 10
Verdict: ACCEPTED
| input |
|---|
| Fsqn-ggoou-padnrosondpf-mtsjfs... |
| correct output |
|---|
| Gsqnggoougaggrosogggfmgsjfsagl... |
| user output |
|---|
| Gsqnggoougaggrosogggfmgsjfsagl... |
Test 11
Verdict: ACCEPTED
| input |
|---|
| Ojaivaeduuucykdclkyammbvozytuk... |
| correct output |
|---|
| Njaivaeduuucykdclkyammbvozytuk... |
| user output |
|---|
| Njaivaeduuucykdclkyammbvozytuk... |
Test 12
Verdict: ACCEPTED
| input |
|---|
| Uprtouo-nvnabbiedq-vzogovufjaa... |
| correct output |
|---|
| Tprtouotvtattietqvzotovufjaaee... |
| user output |
|---|
| Tprtouotvtattietqvzotovufjaaee... |
