結果

問題 No.339 何人が回答したのか
ユーザー akakimidori
提出日時 2016-12-10 19:25:09
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 327 bytes
コンパイル時間 845 ms
コンパイル使用メモリ 19,840 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-29 02:01:10
合計ジャッジ時間 1,919 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 61
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘run’:
main.c:15:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |   scanf("%d",&n);
      |   ^~~~~~~~~~~~~~
main.c:21:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |     scanf("%d",&a);
      |     ^~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

int gcd(int x,int y){
  int r=x%y;
  while(r>0){
    x=y;
    y=r;
    r=x%y;
  }
  return y;
}

void run(void){
  int n;
  scanf("%d",&n);

  int a;
  int i;
  int t=100;
  for(i=0;i<n;i++){
    scanf("%d",&a);
    t=gcd(t,a);
  }
  printf("%d\n",100/t);
  return;
}

int main(void){
  run();
  return 0;
}
0