結果
| 問題 | No.4 おもりと天秤 | 
| コンテスト | |
| ユーザー |  ReERishun | 
| 提出日時 | 2020-03-27 04:01:32 | 
| 言語 | C (gcc 13.3.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 614 bytes | 
| コンパイル時間 | 143 ms | 
| コンパイル使用メモリ | 25,856 KB | 
| 実行使用メモリ | 15,048 KB | 
| 最終ジャッジ日時 | 2025-01-02 07:59:30 | 
| 合計ジャッジ時間 | 145,794 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | TLE * 23 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d", &dataNum);
      |         ^~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#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;
}
            
            
            
        