結果

問題 No.3043 yukicoderへようこそ!
ユーザー e869120e869120
提出日時 2019-04-01 22:01:15
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,131 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 65,844 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 01:04:45
合計ジャッジ時間 1,152 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

string S, T, U;

long long solve_5(string V) {
	long long ans = 0;
	V += " "; string str = "";
	for (int i = 0; i < V.size(); i++) {
		if (V[i] == ' ') {
			ans += stoll(str);
			str = "";
		}
		else str += V[i];
	}
	return ans;
}

int main() {
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] >= 'a' && S[i] <= 'z') {
			cout << "Hello World!" << endl;
			return 0;
		}
	}

	cin >> T;
	if (T == "") {
		int N = stoi(S);
		if (N >= 80) {
			cout << N * (N + 1) / 2 << endl;
		}
		else {
			for (int i = 1; i <= N; i++) {
				if (i % 3 == 0 && i % 5 == 0) cout << "FizzBuzz" << endl;
				else if (i % 3 == 0) cout << "Fizz" << endl;
				else if (i % 5 == 0) cout << "Buzz" << endl;
				else cout << i << endl;
			}
		}
		return 0;
	}

	cin >> U;
	for (int i = 0; i < U.size(); i++) {
		if (!(U[i] >= '0' && U[i] <= '9')) {
			cout << stoll(S) + stoll(T) << " " << U << endl;
			return 0;
		}
	}

	long long N = stoll(S);
	long long s = stoll(T) + stoll(U);
	for (int i = 2; i < N; i++) {
		long long ss; cin >> ss;
		s += ss;
	}
	cout << s << endl;
	return 0;
}
0