結果
| 問題 | No.894 二種類のバス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-29 06:59:22 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
RE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 704 bytes |
| 記録 | |
| コンパイル時間 | 979 ms |
| コンパイル使用メモリ | 102,148 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-19 06:16:41 |
| 合計ジャッジ時間 | 3,454 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | AC * 1 WA * 3 RE * 13 |
コンパイルメッセージ
main.cpp: In function 'long long int gcd(long long int, long long int)':
main.cpp:29:12: warning: control reaches end of non-void function [-Wreturn-type]
29 | gcd(b%a, a);
| ~~~^~~~~~~~
ソースコード
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
//#include<bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (a == 0)return b;
gcd(b%a, a);
}
int main() {
long long int t, a, b;
cin >> t >> a >> b;
if (a > b)swap(a, b);
long long int m = gcd(a, b);
long long int x = (t-1) / a , y = (t-1) / b ;
long long int z = x / (b/m);
cout << x + y - z + 1 << endl;
return 0;
}