結果
問題 | No.593 4進FizzBuzz |
ユーザー |
|
提出日時 | 2020-07-14 12:09:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 104 ms / 2,000 ms |
コード長 | 716 bytes |
コンパイル時間 | 998 ms |
コンパイル使用メモリ | 108,524 KB |
最終ジャッジ日時 | 2025-01-11 20:30:15 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <queue> #include <cstdio> #include <ctime> #include <assert.h> #include <chrono> #include <random> #include <numeric> #include <set> using namespace std; typedef long long int ll; using ull = unsigned long long; bool check(string s,int p){ int n=s.size(); int res=0; for(int i=0;i<n;i++){ res=(res*4+s[i]-'0')%p; } return res==0; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); string s; cin >> s; if(check(s,3)||check(s,5)){ if(check(s,3))printf("Fizz"); if(check(s,5))printf("Buzz"); printf("\n"); } else{ cout << s << endl; } }