結果
| 問題 | 
                            No.894 二種類のバス
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kafuka97
                         | 
                    
| 提出日時 | 2019-09-27 22:02:32 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 614 bytes | 
| コンパイル時間 | 1,490 ms | 
| コンパイル使用メモリ | 165,844 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-24 12:46:25 | 
| 合計ジャッジ時間 | 2,405 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 2 WA * 15 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef int64_t i64;
typedef uint64_t ui64;
const int inf=1073741823;
const i64 llinf=4611686018427387903LL;
i64 gcd(i64 a,i64 b){
    i64 t,r;
    if(a<b){
        t=a;
        a=b;
        b=t;
    }
    r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}
int digit(i64 n){
    int t=1;
    while(n>=10){
        n/=10;
        t++;
    }
    return t;
}
int main(void){
    i64 t,a,b;
    scanf("%lli%lli%lli",&t,&a,&b);
    double g=((double)a)/gcd(a,b)*b;
    printf("%lli\n",t/a+t/b-(i64)(((double)t)/g));
    return 0;
}
            
            
            
        
            
kafuka97