|
|
вернуться в форумTo type “!”, press “0” three times. ?? should be four times, right? Re: To type “!”, press “0” three times. ?? should be four times, right? #include <iostream> using namespace std; int cnt(char ch) { if ((ch >= 'a') && (ch <= 'z')) { return (((int)(ch - 'a') % 3) + 1); } switch (ch) { case '#': return (1); break; case ' ': return (2); break; case '0': return (1); break; case '.': return (2); break; case ',': return (3); break; case '!': return (4); break; } return (0); } int main() { int n = 0; char ch; while (cin.get(ch)) { n += cnt(ch); } cout << n << endl; return (0); } what is wrong with my code??? i got 122 at the sample test,,,,, could you help me ?? i cannot figure it out.. thanks.. Re: To type “!”, press “0” three times. ?? should be four times, right? omg... my mistake in understanding the problem... got AC now.... |
|
|