結果
問題 | No.1987 Sandglass Inconvenience |
ユーザー |
![]() |
提出日時 | 2021-12-10 23:20:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 531 bytes |
コンパイル時間 | 1,930 ms |
コンパイル使用メモリ | 166,604 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 16:39:27 |
合計ジャッジ時間 | 2,410 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long #define riano_ std::ios::sync_with_stdio(false);std::cin.tie(nullptr) // 最大公約数を求める ll gcd(ll x,ll y){ ll r=1; if(x<0) x *= -1; if(y<0) y *= -1; if(x<=y) swap(x,y); if(y==0) r=0; while(r>0){ r=x%y; x=y; y=r; } return x; } int main() { riano_; string ans = "No"; ll a,b,c,x; cin >> a >> b >> c >> x; ll g = gcd(a,gcd(b,c)); if(x%g==0) ans = "Yes"; cout << ans << endl; }