結果

問題 No.3043 yukicoderへようこそ!
ユーザー furafura
提出日時 2020-04-13 18:37:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 3,075 ms
コンパイル使用メモリ 207,188 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 21:51:12
合計ジャッジ時間 2,597 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	vector<string> in;
	while(1){
		string s; getline(cin,s);
		if(s.empty()) break;
		in.emplace_back(s);
	}

	if(in.size()==1){ // 9000, 480, 9002
		if(isdigit(in[0][0])){ // 480
			int n=stoi(in[0]);
			cout<<n*(n+1)/2<<'\n';
		}
		else{ // 9000
			cout<<"Hello World!\n";
		}
	}
	else{ // 9001, 9008, 9009
		if(isalpha(in[1][0])){ // 9001
			stringstream ss(in[0]);
			int a,b; ss>>a>>b;
			cout<<a+b<<' '<<in[1]<<'\n';
		}
		else{ // 9008, 9009
			stringstream ss;
			for(auto s:in) ss<<s<<' ';
			int n; ss>>n;
			lint ans=0;
			rep(i,n){
				lint a; ss>>a;
				ans+=a;
			}
			cout<<ans<<'\n';
		}
	}

	return 0;
}
0