結果

問題 No.648  お や す み 
ユーザー newlife171128
提出日時 2018-02-15 22:44:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 799 bytes
コンパイル時間 1,277 ms
コンパイル使用メモリ 158,820 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-13 21:09:34
合計ジャッジ時間 3,217 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include "bits/stdc++.h"
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <unordered_map>
#include <string.h>
#include <utility>

typedef long long ll;
const int INF = 1e8;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;

typedef pair<int, int> P;

int main() {

	unsigned long long n = 0, ans = 0;
	;
	cin >> n;
	ans = n;

	n *= 2;

	unsigned long long k = sqrt(n);

	for (ll i = k + 1; i >= 1; i--) {
		if (i * (i + 1) == n) {
			cout << "YES" << endl;
			cout << i << endl;
			return 0;
		}
		if (i * (i + 1) < n) {
			cout << "NO" << endl;
			return 0;
		}
	}

	return 0;
}

0