提出 #46116795
ソースコード 拡げる
#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[1000010], t[1000010];
int a, b;
signed main()
{
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
// srand(time(NULL));
// T=read();
// while(T--) {
//
// }
n=read(); m=read();
scanf("%s%s", s+1, t+1);
for(i=1; i<=n; ++i) if(s[i]!=t[i]) break;
if(i>n) a=1;
for(i=m-n+1, j=1; i<=m; ++i, ++j) if(s[j]!=t[i]) break;
if(i>m) b=1;
if(a&b) printf("0");
else if(a) printf("1");
else if(b) printf("2"); else printf("3");
return 0;
}
提出情報
コンパイルエラー
Main.cpp: In function ‘int main()’:
Main.cpp:27:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | scanf("%s%s", s+1, t+1);
| ~~~~~^~~~~~~~~~~~~~~~~~
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
200 / 200 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All |
00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 02_corner_00.txt, 02_corner_01.txt, 02_corner_02.txt, 02_corner_03.txt, 03_hack_00.txt, 03_hack_01.txt, 03_hack_02.txt, 03_hack_03.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 00_sample_00.txt |
AC |
1 ms |
3756 KiB |
| 00_sample_01.txt |
AC |
1 ms |
3756 KiB |
| 00_sample_02.txt |
AC |
1 ms |
3808 KiB |
| 00_sample_03.txt |
AC |
1 ms |
3628 KiB |
| 01_random_00.txt |
AC |
1 ms |
3588 KiB |
| 01_random_01.txt |
AC |
1 ms |
3672 KiB |
| 01_random_02.txt |
AC |
1 ms |
3676 KiB |
| 01_random_03.txt |
AC |
1 ms |
3684 KiB |
| 01_random_04.txt |
AC |
1 ms |
3876 KiB |
| 01_random_05.txt |
AC |
1 ms |
3612 KiB |
| 01_random_06.txt |
AC |
1 ms |
3668 KiB |
| 01_random_07.txt |
AC |
1 ms |
3676 KiB |
| 01_random_08.txt |
AC |
1 ms |
3872 KiB |
| 01_random_09.txt |
AC |
1 ms |
3676 KiB |
| 01_random_10.txt |
AC |
1 ms |
3764 KiB |
| 01_random_11.txt |
AC |
1 ms |
3608 KiB |
| 02_corner_00.txt |
AC |
1 ms |
3680 KiB |
| 02_corner_01.txt |
AC |
1 ms |
3768 KiB |
| 02_corner_02.txt |
AC |
1 ms |
3628 KiB |
| 02_corner_03.txt |
AC |
1 ms |
3612 KiB |
| 03_hack_00.txt |
AC |
1 ms |
3580 KiB |
| 03_hack_01.txt |
AC |
1 ms |
3612 KiB |
| 03_hack_02.txt |
AC |
1 ms |
3612 KiB |
| 03_hack_03.txt |
AC |
1 ms |
3672 KiB |