結果

問題 No.1005 BOT対策
コンテスト
ユーザー 👑 tails
提出日時 2020-10-22 18:01:48
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 426 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 110 ms
コンパイル使用メモリ 29,252 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-08 16:22:05
合計ジャッジ時間 966 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:18: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch]
   11 |         int tlen=strlen(t)-1;
      |                  ^~~~~~
main.c:1:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
  +++ |+#include <string.h>
    1 | #pragma GCC optimize("Ofast")
main.c:16:39: warning: ‘memcmp’ argument 3 type is ‘int’ where ‘long unsigned int’ is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   16 |                         if(memcmp(s,t,tlen)==0){
      |                                       ^~~~
<built-in>: note: built-in ‘memcmp’ declared here
main.c:25:39: warning: ‘memcmp’ argument 3 type is ‘int’ where ‘long unsigned int’ is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   25 |                         if(memcmp(s,t,tlen)==0){
      |                                       ^~~~
<built-in>: note: built-in ‘memcmp’ declared here
main.c:33:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   33 |         printf("%d",z);
      |         ^~~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
  +++ |+#include <stdio.h>
    1 | #pragma GCC optimize("Ofast")

ソースコード

diff #
raw source code

#pragma GCC optimize("Ofast")
#pragma GCC target("avx")

char buf[2020];

main(){
	read(0,buf,sizeof buf);
	char*t=buf;
	while(*t-10)++t;
	++t;
	int tlen=strlen(t)-1;
	char*s=buf;
	int z=0;
	if(tlen==1){
		while(*s-10){
			if(memcmp(s,t,tlen)==0){
				z=-1;
				break;
			}else{
				s+=1;
			}
		}
	}else{
		while(*s-10){
			if(memcmp(s,t,tlen)==0){
				z+=1;
				s+=tlen-1;
			}else{
				s+=1;
			}
		}
	}
	printf("%d",z);
}
0