結果

問題 No.88 次はどっちだ
ユーザー Bantako
提出日時 2017-06-28 20:46:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 479 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 23,168 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 14:55:02
合計ジャッジ時間 856 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%s\n",S);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
main(){
    char S[7];
    char name[][7] = {"oda","yukiko"};
    scanf("%s\n",S);
    int count = 0;
    char c;
    for(int i = 0;i < 8;i++){
        while((c=getchar()) != '\n'){
            count += (c=='w' | c=='b');
        }
    }
    int turn = strcmp(S,"oda")?1:0;//odaなら0 yukikoなら1
    printf("%s\n",name[turn^(count%2)]);
}
/*
偶数なら次の手は先手
 0 0 - oda(0)
 0 1 - yukiko(1)
 1 0 - yukiko(1)
 1 1 - oda(0)
 */
0