結果
問題 | No.380 悪の台本 |
ユーザー |
![]() |
提出日時 | 2017-01-22 23:45:26 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 8 ms / 1,000 ms |
コード長 | 1,419 bytes |
コンパイル時間 | 1,663 ms |
コンパイル使用メモリ | 158,312 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-06 23:20:50 |
合計ジャッジ時間 | 2,296 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:65:13: warning: ‘char* gets(char*)’ is deprecated [-Wdeprecated-declarations] 65 | while(gets(in)){ | ~~~~^~~~ In file included from /usr/include/stdio.h:894, from /usr/include/c++/11/cstdio:42, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:46, from main.cpp:1: /usr/include/x86_64-linux-gnu/bits/stdio2.h:240:1: note: declared here 240 | gets (char *__str) | ^~~~ /usr/bin/ld: /tmp/ccn6YaKT.o: in function `main': main.cpp:(.text.startup+0x29): 警告: the `gets' function is dangerous and should not be used.
ソースコード
#include<bits/stdc++.h>using namespace std;#define REP(i,a,b) for(i=a;i<b;i++)#define rep(i,n) REP(i,0,n)char in[1000000];int isSame(const char a[], const char b[], int len){int i;rep(i,len) if(a[i] != b[i]) return 0;return 1;}int isD(char a){if('a' <= a && a <= 'z') return 1;if('0' <= a && a <= '9') return 1;return 0;}int solve(void){int i, j, len;len = strlen(in);REP(i,5,len) if('A'<=in[i]&&in[i]<='Z') in[i] += 'a'-'A';if(isSame(in, "digi ", 5)){rep(i,4) in[i] = ' ';rep(i,4){if(isSame(in+len-3, "nyo", 3)) return 1;if(isD(in[len-1])) return 0;len--;}}else if(isSame(in, "petit ", 6)){rep(i,5) in[i] = ' ';rep(i,4){if(isSame(in+len-3, "nyu", 3)) return 1;if(isD(in[len-1])) return 0;len--;}}else if(isSame(in, "rabi ", 5)){rep(i,4) in[i] = ' ';rep(i,len) if(isD(in[i])) return 1;}else if(isSame(in, "gema ", 5)){rep(i,4) in[i] = ' ';rep(i,4){if(isSame(in+len-4, "gema", 4)) return 1;if(isD(in[len-1])) return 0;len--;}}else if(isSame(in, "piyo ", 5)){rep(i,4) in[i] = ' ';rep(i,4){if(isSame(in+len-3, "pyo", 3)) return 1;if(isD(in[len-1])) return 0;len--;}}return 0;}int main(){while(gets(in)){if(solve()) puts("CORRECT (maybe)");else puts("WRONG!");}return 0;}