結果
問題 |
No.1702 count good string
|
ユーザー |
![]() |
提出日時 | 2021-10-08 23:23:09 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 647 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 31,360 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-23 07:21:13 |
合計ジャッジ時間 | 1,641 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 47 |
コンパイルメッセージ
main.c: In function 'main': main.c:15:3: warning: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 15 | gets(s,8); | ^~~~ | fgets /usr/bin/ld: /tmp/ccXy9vQe.o: in function `main': main.c:(.text.startup+0x13): 警告: the `gets' function is dangerous and should not be used.
ソースコード
#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include<stdio.h> #define mod 1000000007 void p(unsigned int* x,const unsigned int y){ *x+=y; if(*x>=mod)*x-=mod; } unsigned int dp[2][10]; char* t="yukicoder"; char x,s[8]; int main(){ gets(s,8); dp[0][0]=1; while(~(x=getchar())){ if(x=='?'){ for(unsigned int j=0;j<9;++j){ p(&dp[1][j+1],dp[0][j]); } }else{ for(unsigned int j=0;j<9;++j){ if(x==t[j]){ p(&dp[0][j+1],dp[0][j]); p(&dp[1][j+1],dp[1][j]); } } } } p(&dp[0][9],dp[1][9]); printf("%u\n",dp[0][9]); }