結果
| 問題 | No.18 うーさー暗号 |
| コンテスト | |
| ユーザー |
rsk0315
|
| 提出日時 | 2020-03-15 21:47:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 262 bytes |
| コンパイル時間 | 749 ms |
| コンパイル使用メモリ | 55,040 KB |
| 最終ジャッジ日時 | 2025-01-09 07:08:54 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%s", buf);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <cstdio>
#include <string>
int main() {
char buf[2048];
scanf("%s", buf);
std::string s = buf;
for (size_t i = 0; i < s.length(); ++i) {
int z = (i+1) % 26;
s[i] -= z;
if (s[i] < 'A') s[i] += 26;
}
printf("%s\n", s.c_str());
}
rsk0315