| Task: | Nimionese |
| Sender: | OOliOO_slayer |
| Submission time: | 2015-11-25 19:41:07 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.06 s | details |
| #2 | ACCEPTED | 0.06 s | details |
| #3 | ACCEPTED | 0.05 s | details |
| #4 | ACCEPTED | 0.05 s | details |
| #5 | ACCEPTED | 0.04 s | details |
| #6 | ACCEPTED | 0.05 s | details |
| #7 | ACCEPTED | 0.05 s | details |
| #8 | ACCEPTED | 0.05 s | details |
| #9 | ACCEPTED | 0.06 s | details |
| #10 | ACCEPTED | 0.04 s | details |
| #11 | ACCEPTED | 0.05 s | details |
| #12 | ACCEPTED | 0.05 s | details |
Compiler report
input/code.cpp: In function 'bool is_hard(char)':
input/code.cpp:17:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < hard.size(); i++){
^
input/code.cpp: In function 'int main()':
input/code.cpp:66:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < words.size(); i++){
^
input/code.cpp:69:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < words.size(); i++){
^
input/code.cpp:72:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j = 0; j < word.size(); j++){
^
input/code.cpp:80:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < words.size(); i++){
^
input/code.cpp:89:36: warni...Code
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <sstream>
#include <utility>
#include <set>
#include <iomanip>
using namespace std;
typedef long long LL;
string hard = "bcdgknpt";
bool is_hard(char c){
for(int i = 0; i < hard.size(); i++){
if(hard[i] == c) return true;
}
return false;
}
char nearest_hard(char c){
char best_char;
int best_dist = 1000;
for(char h : hard){
int dist = abs(c-h);
if(dist < best_dist){
best_dist = dist;
best_char = h;
}
}
return best_char;
}
string vowels = "aou";
char nearest_vowel(char c){
char best_char;
int best_dist = 1000;
for(char h : vowels){
int dist = abs(c-h);
if(dist < best_dist){
best_dist = dist;
best_char = h;
}
}
return best_char;
}
int main(){
cin.tie(0);
ios_base::sync_with_stdio(0);
vector<string> words;
vector<bool> uppercase;
while(true){
string word; cin >> word;
if(!cin.good()) break;
if(word[0] <= 'Z') uppercase.push_back(true);
else uppercase.push_back(false);
word[0] = tolower(word[0]);
words.push_back(word);
}
for(int i = 0; i < words.size(); i++){
words[i][0] = nearest_hard(words[i][0]);
}
for(int i = 0; i < words.size(); i++){
string& word = words[i];
bool flag = false;
for(int j = 0; j < word.size(); j++){
if(word[j] == '-') flag = true;
else if(flag && is_hard(word[j]))
word[j] = nearest_hard(word[0]);
}
}
for(int i = 0; i < words.size(); i++){
string& word = words[i];
if(is_hard(word.back())){
word.push_back(nearest_vowel(word.back()));
word.push_back('h');
// word += nearest_hard(word.back()) + "h";
}
}
for(int word_idx = 0; word_idx < words.size(); word_idx++){
string& word = words[word_idx];
for(int i = 0; i < word.size(); i++){
char c = word[i];
if(c == '-') continue;
if(i == 0 && uppercase[word_idx]) c = toupper(c);
cout << c;
}
cout << " ";
}
cout << endl;
}
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... |
