結果

問題 No.339 何人が回答したのか
ユーザー takatowin
提出日時 2017-01-21 20:49:53
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 22,272 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 04:27:57
合計ジャッジ時間 1,798 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 1 WA * 60
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:22:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 | scanf("%d",&n);
      | ^~~~~~~~~~~~~~
main.c:25:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |   scanf("%d",&a[i]);
      |   ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
int max(int a,int b){
  int x=1,i;
  if(a==1)
    return b;
  if(a>b){
    int temp;
    temp=a;
    a=b;
    b=temp;
  }
  for(i=1;i<=a;i++)
    if(a%i==0 && b%i==0){
      x=i;
      printf("%d ",i );
    }
  return x;
}
int main(void){
int n,temp=1;
scanf("%d",&n);
int a[n],i;
for(i=0;i<n;i++)
  scanf("%d",&a[i]);
if(n==1){
  printf("1\n");
  return 0;
}
for(i=0;i<n;i++)
  temp=max(temp,a[i]);
printf("%d\n",100/temp);
}

0