結果
問題 | No.18 うーさー暗号 |
ユーザー |
![]() |
提出日時 | 2017-10-22 14:18:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 697 bytes |
コンパイル時間 | 618 ms |
コンパイル使用メモリ | 79,708 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 06:38:07 |
合計ジャッジ時間 | 1,200 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:34:19: warning: 'p' may be used uninitialized [-Wmaybe-uninitialized] 34 | p -= (i + 1); | ~~^~~~~~~~~~ main.cpp:27:21: note: 'p' was declared here 27 | int p; | ^
ソースコード
#include<iostream> #include<string> #include<string.h> #include<algorithm> #include<stdio.h> #include<cmath> #include<vector> #include<utility> #include<stack> #include<queue> #include<list> #include<bitset> #define FOR(i, a, b) for(int i=(a);i<=(b);i++) #define RFOR(i, a, b) for(int i=(a);i>=(b);i--) #define MOD 1000000007 #define INF 1000000000 using namespace std; int main(void) { string s; cin >> s; FOR(i, 0, s.size() - 1) { int p; FOR(t, 1, 26) { if (s[i] == 'A' + t - 1) { p = t; break; } } p -= (i + 1); if (p % 26 == 0) { p = 26; } else { p %= 26; } if (p < 0) { p = 26 + p; } s[i] = 'A' + p - 1; } cout << s << endl; return 0; }