結果
問題 | No.1806 Rotating Golem |
ユーザー | houren |
提出日時 | 2022-01-14 21:23:56 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 550 bytes |
コンパイル時間 | 1,639 ms |
コンパイル使用メモリ | 164,668 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-12 17:30:53 |
合計ジャッジ時間 | 2,358 ms |
ジャッジサーバーID (参考情報) |
judge7 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 2 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 2 ms
4,376 KB |
testcase_10 | AC | 2 ms
4,380 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 2 ms
4,380 KB |
testcase_13 | AC | 1 ms
4,380 KB |
testcase_14 | AC | 1 ms
4,380 KB |
testcase_15 | AC | 2 ms
4,380 KB |
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:21:15: 警告: ‘q’ may be used uninitialized [-Wmaybe-uninitialized] 21 | cout << (q+4-p)%4 << endl; | ~^~ main.cpp:14:11: 備考: ‘q’ はここで定義されています 14 | int p,q; | ^ main.cpp:21:17: 警告: ‘p’ may be used uninitialized [-Wmaybe-uninitialized] 21 | cout << (q+4-p)%4 << endl; | ~~~~^~~ main.cpp:14:9: 備考: ‘p’ はここで定義されています 14 | int p,q; | ^
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll,ll>; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;} int main(){ string s = "NESW"; char a,b; cin >> a >> b; int p,q; rep(i,4){ if(a==s[i]) p = i; } rep(i,4){ if(b==s[i]) q = i; } cout << (q+4-p)%4 << endl; return 0; }