結果
問題 | No.486 3 Straight Win(3連勝) |
ユーザー |
|
提出日時 | 2017-03-30 18:49:02 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 788 bytes |
コンパイル時間 | 222 ms |
コンパイル使用メモリ | 28,416 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-26 04:24:33 |
合計ジャッジ時間 | 1,183 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <stdio.h>#include <stdbool.h>typedef struct {int east;int west;char scores[101];} battleInfo;void which_winner(battleInfo *data);int main(void){battleInfo data;scanf("%s", data.scores);which_winner(&data);return 0;}void which_winner(battleInfo *data){bool isFound = false;data->west = 0;data->east = 0;for (int i = 0; data->scores[i] != '\0'; ++i) {if (data->scores[i] == 'O') {data->east++;data->west = 0;} else {data->west++;data->east = 0;}if (data->east == 3) {printf("East\n");isFound = true;break;} else if (data->west == 3) {printf("West\n");isFound = true;break;}}if (isFound == false) {printf("NA\n");}}