結果

問題 No.736 約比
ユーザー funakoshifunakoshi
提出日時 2019-09-05 17:37:35
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 956 bytes
コンパイル時間 4,530 ms
コンパイル使用メモリ 31,360 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-11 20:48:19
合計ジャッジ時間 3,398 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 58
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int main(void)
{
    int num;
    long long int renpi[101]={0};
    long long int ans[101]={0};
    int a,b,c;
    scanf("%d",&num);
    for(int i=0;i<num;i++)
    {
        scanf("%d",&renpi[i]);
    }
    b=renpi[0];
    for(int i=0;i<num-1;i++)
    {
        a=renpi[i+1];
        while(1)
        {
            c=a%b;
            a=b;
            b=c;
            if(c==0)
            {
                ans[i]=a;
                break;
            }
        }
        b=a;
    }
    for(int i=0;i<num-2;i++)
    {
        if(ans[i]!=ans[i+1])
        {
            for(int i=0;i<num-1;i++)
            {
                printf("%d:",renpi[i]);
            }
            printf("%d",renpi[num-1]);
            return 0;
        }
    }
    for(int i=0;i<num-1;i++)
    {
        printf("%d:",renpi[i]/ans[0]);
    }
    printf("%d",renpi[num-1]/ans[0]);
}
0