結果

問題 No.1389 Clumsy Calculation
ユーザー Y_SY_S
提出日時 2021-02-12 21:36:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,050 bytes
コンパイル時間 744 ms
コンパイル使用メモリ 94,648 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-27 03:11:32
合計ジャッジ時間 5,099 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,756 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 5 ms
4,376 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 80 ms
4,380 KB
testcase_10 AC 29 ms
4,376 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 4 ms
4,376 KB
testcase_13 AC 4 ms
4,380 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string,getline, to_string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap, pair
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt,ceil,M_PI, pow, sin
#include <sstream>	//stringstream, getline
#include <numeric>	//gcd, accumlate
#include <deque>	//deque
#include <random>	//randam_device
#include <limits>	//numeric_limits

using namespace std;
constexpr long long int D_MOD = 1000000007;

int main() {

	long long int N, X;
	cin >> N >> X;

	vector<int> S(N);
	for (int i = 0; i < N; i++) {
		cin >> S[i];
	}

	long long int T = X * (N - 1);

	for (int i = 0; i < N; i++) {
		if (S[i] % 2 != 0) {
			continue;
		}
		else {
			int temp = S[i];
			S[i] = S[i] / 2;
			long long int sum = 0;
			for (int j = 0; j < N; j++) {
				sum += S[j];
			}
			if (sum == T) {
				cout << S[i] << endl;
				return 0;
			}
			else {
				S[i] = temp;
			}
		}
	}

	return 0;

}
0