結果

問題 No.4 おもりと天秤
コンテスト
ユーザー ree-rishun
提出日時 2020-03-27 04:03:55
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 614 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 311 ms
コンパイル使用メモリ 37,760 KB
最終ジャッジ日時 2026-02-22 05:31:45
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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; str != '\n'; ) {
		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