結果

問題 No.736 約比
ユーザー akakimidori
提出日時 2018-09-28 21:24:33
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 873 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 05:36:54
合計ジャッジ時間 2,231 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 65
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:17:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |   scanf("%lld",a+0);
      |   ^~~~~~~~~~~~~~~~~
main.c:21:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |     scanf("%lld",a+i);
      |     ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

typedef long long int int64;

int64 gcd(int64 a,int64 b){
  int64 r=a%b;
  while(r>0){
    a=b;b=r;r=a%b;
  }
  return b;
}

void run(void){
  int n;
  scanf("%d",&n);
  int64 a[100];
  scanf("%lld",a+0);
  int64 g=a[0];
  int i;
  for(i=1;i<n;i++){
    scanf("%lld",a+i);
    g=gcd(g,a[i]);
  }
  for(i=0;i<n;i++) a[i]/=g;
  printf("%lld",a[0]);
  for(i=1;i<n;i++) printf(":%lld",a[i]);
  printf("\n");
}

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