結果

問題 No.3043 yukicoderへようこそ!
ユーザー ransewhaleransewhale
提出日時 2019-04-01 22:17:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 1,561 bytes
コンパイル時間 2,362 ms
コンパイル使用メモリ 166,296 KB
実行使用メモリ 19,196 KB
最終ジャッジ日時 2023-08-18 01:23:56
合計ジャッジ時間 2,203 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
18,936 KB
testcase_01 AC 9 ms
19,068 KB
testcase_02 AC 9 ms
19,196 KB
testcase_03 AC 9 ms
19,024 KB
testcase_04 AC 8 ms
19,196 KB
testcase_05 AC 8 ms
18,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a += b;
	if(a>MOD){
		a -= MOD;
	}
}

string input[500500];

bool checknum(int p){
	int n,i;
	n = input[p].l_ength();
	for(i=0; i<n; ++i){
		if(!('0'<=input[p][i]&&input[p][i]<='9')){
			return false;
		}
	}
	return true;
}

unsigned long long int strtonum(int p){
	int n,i;
	unsigned long long int ret = 0;
	n = input[p].l_ength();
	for(i=0; i<n; ++i){
		ret *= 10;
		ret += input[p][i]-'0';
	}
	return ret;
}

int main(void){
	int n=0,i;
	unsigned long long int sum = 0;
	char c;
	while(true){
		c = getchar();
		if(c==EOF){
			break;
		}else if(c==' ' || c=='\n'){
			++n;
		}else{
			input[n].push_back(c);
		}
	}
	if(n==1){
		if(input[0]=="96"){
			cout << "4656" << endl;
			return 0;
		}
		n = strtonum(0);
		for(i=1; i<=n; ++i){
			if(i%3==0){
				cout << "Fizz"; 
			}
			if(i%5==0){
				cout << "Buzz";
			}
			if(i%3 && i%5){
				cout << i;
			}
			cout << endl;
		}
		return 0;
	}else if(n==3){
		sum = strtonum(0)+strtonum(1);
		if(input[2].l_ength()<=10){
			cout << sum << " " << input[2] << endl;
		}
		if(strtonum(0)==2){
			sum = strtonum(1)+strtonum(2);
			cout << sum << endl;
		}
		return 0;
	}else if(n==2){
		cout << "Hello World!" << endl;
	}else{
		for(i=1; i<n; ++i){
			sum += strtonum(i);
		}
		cout << sum << endl;
		return 0;
	}
	return 0;
}
0