結果

問題 No.339 何人が回答したのか
ユーザー FF256grhy
提出日時 2016-01-29 23:10:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 356 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 22,144 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 18:37:57
合計ジャッジ時間 1,828 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
main.cpp:9:39: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         for(i = 0; i < n; i++) { scanf("%d", &a[i]); }
      |                                  ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int d[9] = {1, 2, 4, 5, 10, 20, 25, 50, 100};
int n, a[100];

int main(void) {
	int i, j;
	scanf("%d", &n);
	for(i = 0; i < n; i++) { scanf("%d", &a[i]); }
	
	int flag;
	for(j = 0; j < 9; j++) {
		flag = 1;
		for(i = 0; i < n; i++) {
			if(a[i] % (100 / d[j]) != 0) { flag = 0; }
		}
		if(flag) { printf("%d\n", d[j]); return 0; }
	}
}
0