結果

問題 No.413 +5,000,000pts
ユーザー tossytossy
提出日時 2016-09-20 00:02:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 818 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 81,152 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-08-10 23:26:00
合計ジャッジ時間 1,184 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483600

long calc(long d) {
  return (long)((-1 + sqrt(1 + 4*d)) / 2.0);
}

int main(){
  int cnt=0;
  long n=999999999;
  while(cnt<100000 && n>=0){
    long m = n*n+n;
    long r = m-1;
    while(calc(r) == n){
      printf("%ld\n", r);
      r--;
      cnt++;
    }
    n--;
  }

  return 0;
}
0