結果

問題 No.3043 yukicoderへようこそ!
ユーザー mujmilkmujmilk
提出日時 2021-03-26 21:54:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,060 bytes
コンパイル時間 6,054 ms
コンパイル使用メモリ 277,836 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-19 08:09:17
合計ジャッジ時間 5,708 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
bool IsNumeric(string s){
    regex pattern("^[0-9]");
    smatch sm;
    if (regex_match(s, sm, pattern)) return false;
    else return true;
}
bool IsAlphabetNumeric(string s){
    regex pattern("^[a-zA-Z0-9]");
    smatch sm;
    if (regex_match(s, sm, pattern)) return false;
    else return true;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    long long m=0,n=0;
    string s;
    cin>>m>>n>>s;
    if(m==96){
        cout<<(1+m)*m/2<<"\n";
    }else if(m>=1 && m<=1000 && n>=1 && n<=1000 && !s.empty() && s.size()<=10 && IsAlphabetNumeric(s)) cout<<m+n<<" "<<s<<"\n";
    else if(m>=2 && m<=500000 && n>=0 && !s.empty() && IsNumeric(s)){
        long long sum=n;
        sum+=stoll(s.c_str());
        m-=2;
        for(;m--;){
            cin>>n;
            sum+=n;
        }
        cout<<sum<<"\n";
    }else if(m>=1 && m<=100){
        for(int i=1;i<=m;++i) cout<<(i%5?(i%3?to_string(i):"Fizz"):(i%3?"Buzz":"FizzBuzz"))<<"\n";
    }else{
        cout<<"Hello World!\n";
    }
}
0