結果
| 問題 | No.346 チワワ数え上げ問題 |
| コンテスト | |
| ユーザー |
ykringum
|
| 提出日時 | 2019-05-01 02:39:08 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 137µs | |
| コード長 | 379 bytes |
| 記録 | |
| コンパイル時間 | 55 ms |
| コンパイル使用メモリ | 37,760 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-22 07:24:19 |
| 合計ジャッジ時間 | 1,644 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <stdio.h>
#include <string.h>
int main(void) {
int w = 0;
char s[100001];
scanf("%s", &s);
int l = strlen(s);
long long res = 0;
for( int i = l - 1; i >= 0; i--) {
if( s[i] == 'w' ) {
w++;
}
else if( s[i] == 'c' ) {
res += w * (w-1ll) /2 ;
}
}
printf("%lld\n", res);
return 0;
}
ykringum