結果

問題 No.4 おもりと天秤
ユーザー ReERishunReERishun
提出日時 2020-03-27 04:01:32
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 614 bytes
コンパイル時間 1,881 ms
コンパイル使用メモリ 28,732 KB
実行使用メモリ 10,292 KB
最終ジャッジ日時 2023-08-30 16:01:41
合計ジャッジ時間 14,254 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include <stdlib.h>

int main() {
	int dataNum = 0;
	int data[1000];
	char str;
	int total = 0;
	int harf = 0;

	scanf("%d", &dataNum);

	for (int i = 0; i < dataNum; i++)
		data[i] = 0;

	for (int i = 0; i < dataNum; ) {
		str = getchar();
		if (str == '\0')
			i++;
		else
			data[i] = data[i] * 10 + (int)str - (int)'0';
	}

	// 合計値を求める
	for (int i = 0; i < dataNum; i++)
		total += data[i];

	// 偶数でない場合はimpossible
	if (total % 2 == 0) {
		printf("impossible");
		return 0;
	}

	// 半分の値を求める
	harf = total / 2;

	printf("possible");

	return 0;
}
0