結果
問題 |
No.672 最長AB列
|
ユーザー |
|
提出日時 | 2018-04-14 06:34:51 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 313 bytes |
コンパイル時間 | 315 ms |
コンパイル使用メモリ | 22,272 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 20:05:11 |
合計ジャッジ時間 | 806 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 2 WA * 14 |
ソースコード
#include <stdio.h> #include <string.h> char str[200001]; int main(){ int cnt_a = 0, cnt_b = 0; int length = strlen(str); int ret = -1; for(int i = 0; i < length ; i++){ if(str[i]=='a') cnt_a++; else cnt_b++; if(cnt_a == cnt_b) ret = i; } printf("%d\n",ret+1); }