結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-06 04:07:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 260 bytes |
| コンパイル時間 | 484 ms |
| コンパイル使用メモリ | 65,724 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-17 19:42:05 |
| 合計ジャッジ時間 | 1,324 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
string s;
long ans;
main()
{
long cnt=0;
cin>>s;
for(int i=0;i<s.size();i++)cnt+=s[i]=='w';
for(int i=0;i<s.size();i++)
{
if(s[i]=='w')cnt--;
else if(s[i]=='c')
{
ans+=cnt*(cnt-1)/2;
}
}cout<<ans<<endl;}