結果

問題 No.1806 Rotating Golem
ユーザー Md Shahinur RahmanMd Shahinur Rahman
提出日時 2022-01-14 21:44:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 262 bytes
コンパイル時間 1,390 ms
コンパイル使用メモリ 167,536 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-30 13:50:38
合計ジャッジ時間 1,962 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 1 ms
6,940 KB
testcase_05 WA -
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 WA -
testcase_12 AC 2 ms
6,944 KB
testcase_13 WA -
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:12:21: warning: 'idx2' may be used uninitialized [-Wmaybe-uninitialized]
   12 |     cout << abs(idx1-idx2);
      |                 ~~~~^~~~~
main.cpp:7:14: note: 'idx2' was declared here
    7 |     int idx1,idx2;
      |              ^~~~
main.cpp:12:21: warning: 'idx1' may be used uninitialized [-Wmaybe-uninitialized]
   12 |     cout << abs(idx1-idx2);
      |                 ~~~~^~~~~
main.cpp:7:9: note: 'idx1' was declared here
    7 |     int idx1,idx2;
      |         ^~~~

ソースコード

diff #

// USING C++
#include<bits/stdc++.h>
using namespace std;
int main(){
    string t,s="ESWN";
    char c1,c2;cin >> c1 >> c2;
    int idx1,idx2;
    for(int i=0;i<4;i++){
        if(c1==s[i])idx1=i;
        if(c2==s[i])idx2=i;
    }
    cout << abs(idx1-idx2);
}
0