結果
| 問題 |
No.1806 Rotating Golem
|
| コンテスト | |
| ユーザー |
forest3
|
| 提出日時 | 2022-01-30 14:42:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 272 bytes |
| コンパイル時間 | 1,913 ms |
| コンパイル使用メモリ | 166,280 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 08:16:43 |
| 合計ジャッジ時間 | 2,008 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:15:13: warning: 'b' may be used uninitialized [-Wmaybe-uninitialized]
15 | int ans = b - a;
| ^~~
main.cpp:10:16: note: 'b' was declared here
10 | int a, b;
| ^
main.cpp:15:13: warning: 'a' may be used uninitialized [-Wmaybe-uninitialized]
15 | int ans = b - a;
| ^~~
main.cpp:10:13: note: 'a' was declared here
10 | int a, b;
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
char A, B;
cin >> A >> B;
string s = "ESWN";
int a, b;
for( int i = 0; i < 4; i++ ) {
if( s[i] == A ) a = i;
if( s[i] == B ) b = i;
}
int ans = b - a;
if( ans < 0 ) ans += 4;
cout << ans << endl;
}
forest3