結果
問題 |
No.894 二種類のバス
|
ユーザー |
![]() |
提出日時 | 2019-10-16 12:10:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,416 bytes |
コンパイル時間 | 1,024 ms |
コンパイル使用メモリ | 103,424 KB |
実行使用メモリ | 27,264 KB |
最終ジャッジ日時 | 2024-06-11 20:30:34 |
合計ジャッジ時間 | 5,290 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | TLE * 1 -- * 16 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; namespace algo { class Program { static void Main(string[] args) { string[] N = Console.ReadLine().Split(' '); ulong T = ulong.Parse(N[0]); ulong A = ulong.Parse(N[1]); ulong B = ulong.Parse(N[2]); ulong ans = 1; ulong a= 1; ulong i = 2; while (true) { if( A % i == 0 && B % i == 0) { a *= i; A /= i; B /= i; } else { i++; } if(A < 4 || B < 4) { a *= A * B; break; } } A = ulong.Parse(N[1]); B = ulong.Parse(N[2]); if(T % A == 0) { ans += T / A - 1; } else { ans += T / A; } if (T % B == 0) { ans += T / B - 1; } else { ans += T / B; } if(T > a && T % a != 0) { ans -= T / a; } else { ans -= T / a - 1; } Console.WriteLine(ans); } } }