結果
問題 | No.18 うーさー暗号 |
ユーザー |
|
提出日時 | 2019-03-10 14:04:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 831 bytes |
コンパイル時間 | 590 ms |
コンパイル使用メモリ | 74,464 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 15:17:35 |
合計ジャッジ時間 | 1,170 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
ソースコード
#include <iostream>#include <stdio.h>#include <cmath>#include <algorithm>#include <vector>#define FOR(i, a, b) for (int i = a; i < b; i++)#define FORN(i, a, b) for (int i = a; i <= b; i++)#define P(s) cout << s << endl#define PC(condition, _true, _false) if (condition) _true; else _false;#define toInt(_char) _char - '0'using namespace std;//// Created by karayuu on 2018-12-18.//int main() {string s;cin >> s;string ans;for (int i = 1; i <= s.length(); i++) {char c = s[i - 1];int d = c - 'A'; //ここでcと'A'の差がわかるd += 2600; //適当に大きな値を足してマイナスになるのを防ぐd -= i; //これで文字を戻すd %= 26; //26で割って本当の文字コードに直すans += 'A' + d;}P(ans);}