結果
| 問題 |
No.457 (^^*)
|
| コンテスト | |
| ユーザー |
rickytheta
|
| 提出日時 | 2016-12-08 00:31:06 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 645 bytes |
| コンパイル時間 | 1,585 ms |
| コンパイル使用メモリ | 157,552 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-28 04:28:25 |
| 合計ジャッジ時間 | 2,118 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
16 | scanf("%s",s);
| ~~~~~^~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
// O(n)
int dp[2][6][12525];
char s[12525];
char t[2][1252] = {"(*^^)", "(^^*)"};
int n;
int main(){
scanf("%s",s);
n = strlen(s);
int ans[2] = {0,0};
REP(i,n)REP(x,2)REP(j,5){
if(t[x][j] == s[i]){
if(j==0){
dp[x][j+1][i+1] += 1;
}else if(j==4){
ans[x] += dp[x][j][i];
dp[x][j][i+1] += dp[x][j][i];
}else{
dp[x][j+1][i+1] += dp[x][j][i];
}
}else{
dp[x][j][i+1] += dp[x][j][i];
}
}
printf("%d %d\n",ans[1],ans[0]);
return 0;
}
rickytheta