提出 #23218171


ソースコード 拡げる

#include <bits/stdc++.h>
#define ll long long int
#define max(a,b) (a>b?a:b)
#define min(a,b) (a>b?b:a)
#define IOS ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define loop(start,end,step) for(ll i=start;i<end;i+=step)

using namespace std;

void solve()
{
    ll x,y;
    cin>>x>>y;
    ll ans=0;
    if(x!=y)
    {
      if(x==0 && y==1 || x==1 && y==0)
        ans=2;
      else if(x==1 && y==2 || x==2 && y==1)
        ans=3;
      else if(x==2 && y==0 || x==0 && y==2)
        ans=0;
    }
    else
    {
      ans=x;
    }
    cout<<ans<<endl;

}   
    
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    
    solve();
    
    return 0;
}

提出情報

提出日時
問題 A - Rock-paper-scissors
ユーザ IamSPEED
言語 C++ (GCC 9.2.1)
得点 0
コード長 784 Byte
結果 WA
実行時間 8 ms
メモリ 3628 KiB

コンパイルエラー

./Main.cpp: In function ‘void solve()’:
./Main.cpp:17:15: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
   17 |       if(x==0 && y==1 || x==1 && y==0)
      |          ~~~~~^~~~~~~
./Main.cpp:19:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
   19 |       else if(x==1 && y==2 || x==2 && y==1)
      |               ~~~~~^~~~~~~
./Main.cpp:21:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
   21 |       else if(x==2 && y==0 || x==0 && y==2)
      |               ~~~~~^~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 100
結果
AC × 2
AC × 5
WA × 4
セット名 テストケース
Sample random_00.txt, random_01.txt
All random_00.txt, random_01.txt, random_02.txt, random_10.txt, random_11.txt, random_12.txt, random_20.txt, random_21.txt, random_22.txt
ケース名 結果 実行時間 メモリ
random_00.txt AC 8 ms 3600 KiB
random_01.txt AC 2 ms 3588 KiB
random_02.txt WA 2 ms 3628 KiB
random_10.txt AC 2 ms 3444 KiB
random_11.txt AC 2 ms 3572 KiB
random_12.txt WA 3 ms 3596 KiB
random_20.txt WA 2 ms 3396 KiB
random_21.txt WA 2 ms 3568 KiB
random_22.txt AC 2 ms 3448 KiB