結果

問題 No.3043 yukicoderへようこそ!
ユーザー ransewhaleransewhale
提出日時 2019-04-01 22:06:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,397 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 168,028 KB
実行使用メモリ 19,200 KB
最終ジャッジ日時 2024-05-05 07:59:58
合計ジャッジ時間 1,962 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
19,200 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 12 ms
18,944 KB
testcase_04 AC 13 ms
19,072 KB
testcase_05 AC 12 ms
19,072 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(!checknum(0)){
			cout << "Hello World!" << endl;
		}
		n = strtonum(0);
		if(1<=n && n<=100){
			cout << (n*(n+1)/2) << 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{
		for(i=1; i<n; ++i){
			sum += strtonum(i);
		}
		cout << sum << endl;
		return 0;
	}
	return 0;
}
0