結果

問題 No.2037 NAND Pyramid
ユーザー publfl2publfl2
提出日時 2022-08-12 22:16:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 540 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 32,312 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 10:25:25
合計ジャッジ時間 4,783 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 6 ms
4,348 KB
testcase_13 AC 4 ms
4,348 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 2 ms
4,348 KB
testcase_39 AC 2 ms
4,348 KB
testcase_40 AC 2 ms
4,348 KB
testcase_41 AC 2 ms
4,348 KB
testcase_42 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

char x[100010],y[100010],z[100010];
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	b = (a-b+1);
	scanf("%s",x+1);
	for(int i=1;i<=a-1;i++)
	{
		if(x[i]=='1'&&x[i+1]=='1') y[i] = '0';
		else y[i] = '1';
	}
	for(int i=1;i<=a-2;i++)
	{
		if(y[i]=='1'&&y[i+1]=='1') z[i] = '0';
		else z[i] = '1';
	}
	
	if(b==1) for(int i=1;i<=a;i++) printf("%c",x[i]);
	else if(b%2==0)
	{
		int t = (b-2)/2;
		for(int i=t+1;i<=a-1-t;i++) printf("%c",y[i]);
	}
	else
	{
		int t = (b-3)/2;
		for(int i=t+1;i<=a-2-t;i++) printf("%c",z[i]);
	}
}
0