結果
| 問題 | No.593 4進FizzBuzz |
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-16 10:35:17 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 2,000 ms |
| コード長 | 548 bytes |
| 記録 | |
| コンパイル時間 | 2,107 ms |
| コンパイル使用メモリ | 193,652 KB |
| 最終ジャッジ日時 | 2025-01-09 07:20:06 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
std::string s;std::cin>>s;
lint n=s.length();
lint three=0,five=0;
for(lint i=0;i<n;i++){
lint x=s.at(i)-'0';
three+=x;
five+=(i&1?-1:+1)*x;
}
three=std::abs(three)%3;
five=std::abs(five)%5;
std::cout<<(
!three&&!five?"FizzBuzz"
:!three?"Fizz"
:!five?"Buzz"
:s)<<'\n';
}
ngtkana