結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2023-07-03 11:19:10 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 627 bytes |
コンパイル時間 | 241 ms |
コンパイル使用メモリ | 30,336 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-17 08:44:07 |
合計ジャッジ時間 | 1,376 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 7 WA * 22 |
ソースコード
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <math.h> #include <string.h> int main() { int c = -1; int w1 = -1; int w2 = -1; int strNum = 0; char str[100001] = "chiwaaaaaaamikawayadeeeeesu"; scanf("%s", str); for (int i = 0;str[i] != '\0';i++) { if (str[i] == 'c' && c == -1) { c = i; break; } } for (int i = c + 1;str[i] != '\0';i++) { if (str[i] == 'w' && w1 == -1) { w1 = i; break; } } for (int i = w1 + 1;str[i] != '\0';i++) { if (str[i] == 'w' && w2 == -1) { w2 = i; break; } } strNum = w2 - c + 1; printf("%d\n", strNum ); return 0; }