提出 #46117149


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
//#define int long long
inline int read(){int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;
ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+
(x<<3)+(ch^48);ch=getchar();}return x*f;}
#define Z(x) (x)*(x)
#define pb push_back
//#define M
//#define mo
//#define N
int n, m, i, j, k, T;
char s[100010]; 

signed main()
{
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
//	srand(time(NULL));
//	T=read();
//	while(T--) {
//
//	}
	n=read(); scanf("%s", s+1); 
	for(i=1; i<=n-2; ++i) {
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C') {
			printf("%d", i); exit(0); 
		}
	}
	printf("-1"); 
	return 0;
}

提出情報

提出日時
問題 A - First ABC 2
ユーザ zhangtingxi
言語 C++ 20 (gcc 12.2)
得点 100
コード長 713 Byte
結果 AC
実行時間 1 ms
メモリ 3824 KiB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:25:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |         n=read(); scanf("%s", s+1);
      |                   ~~~~~^~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 100 / 100
結果
AC × 3
AC × 11
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 02_min_00.txt, 03_max_00.txt, 03_max_01.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3800 KiB
00_sample_01.txt AC 1 ms 3824 KiB
00_sample_02.txt AC 1 ms 3716 KiB
01_random_00.txt AC 1 ms 3620 KiB
01_random_01.txt AC 1 ms 3596 KiB
01_random_02.txt AC 1 ms 3820 KiB
01_random_03.txt AC 1 ms 3824 KiB
01_random_04.txt AC 1 ms 3700 KiB
02_min_00.txt AC 1 ms 3616 KiB
03_max_00.txt AC 1 ms 3620 KiB
03_max_01.txt AC 1 ms 3624 KiB