Submission #9336

# Submission time Handle Problem Language Result Execution time Memory
9336 2014-09-28T05:38:11 Z dolpang2 Veni, vidi, vici (kriii2_V) C++14
0 / 4
0 ms 1676 KB
#include <cstdio>
#include <iostream>
#include <string>

int main() {
  int n = 0;

  scanf(" %d", &n);
  std::string word;
  int count = 0;
  while (std::cin >> word) {
    std::string converted;

    if (word.size() % 2 == 1) {
      for (size_t i = 0; i < word.size() - 1; ++i) {
        converted.push_back(word[i]);
      }
    } else {
      converted = word;
    }
    
    std::string ret;
    for (size_t i = 0; i < converted.size(); i += 2) {
      char a = converted[i] - 'a';
      char b = converted[i + 1] - 'a';

      int c = (a + b - n) % 26;
      char d = c + 'a';
      ret.push_back(d);
    }
    
    if (count != 0) {
      std::cout << " ";
    }
    std::cout << ret;
    ++count;
  }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1676 KB Output is correct
2 Correct 0 ms 1676 KB Output is correct
3 Correct 0 ms 1676 KB Output is correct
4 Correct 0 ms 1676 KB Output is correct
5 Correct 0 ms 1676 KB Output is correct
6 Correct 0 ms 1676 KB Output is correct
7 Incorrect 0 ms 1676 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -