結果
| 問題 | No.316 もっと刺激的なFizzBuzzをください |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-05 00:08:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 397 bytes |
| 記録 | |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 23,296 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-26 08:58:41 |
| 合計ジャッジ時間 | 1,338 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | AC * 3 WA * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:9: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%lld %lld %lld %lld", &N, &a, &b, &c);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
typedef long long ll;
ll gcd(ll a, ll b){
if( b > a){ ll tmp = b; b = a; a = tmp;}
ll amari;
while( ( amari = a % b ) != 0 ){ a = b; b = amari; }
return b;
}
ll lcm(ll a, ll b){ return a / gcd(a,b) * b;}
int main(){
ll N,a,b,c;
scanf("%lld %lld %lld %lld", &N, &a, &b, &c);
printf("%lld\n", N/a+N/b+N/c+N/lcm(a,b)+N/lcm(b,c)+N/lcm(c,a)+N/lcm(a,lcm(b,c)));
}