結果

問題 No.3054 ほぼ直角二等辺三角形
ユーザー ahe100ahe100
提出日時 2019-04-01 23:58:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,328 bytes
コンパイル時間 1,371 ms
コンパイル使用メモリ 164,792 KB
実行使用メモリ 4,868 KB
最終ジャッジ日時 2023-08-18 03:39:40
合計ジャッジ時間 2,752 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,868 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll mod = 1e9+7;

/*
3 4 5
20 21 29
119 120 169
4059 4060 5741
137903 137904 195025
4684659 4684660 6625109
a(n) = 3a(n-1) + 2c(n-1) + 1, c(n) = 4a(n-1) + 3c(n-1) + 2
*/

ll x,m=1,ans[3]={},a[100010],c[100010];

struct Xor128{
    unsigned x,y,z,w;
    Xor128():x(123456789),y(362436069),z(521288629),w(88675123){};
    inline unsigned xor128(){
        unsigned t;
        t = x^(x<<11);
        x = y;
        y = z;
        z = w;
        return w = (w^(w>>19))^(t^(t>>8));
    }
    int randInt(int x,int y){//[x,y)
        return xor128()%(y-x)+x;
    }
    double randDouble(double a,double b){//[a,b)
        return (double)(xor128()&0xffff)/0xffff*(b-a)+a;
    }
};
auto rnd=Xor128();

int main(void){
	cin>>x;
	rep(i,x)m*=10;
	a[1]=3;
	c[1]=5;
	if(x==1)cout<<"3 4 5"<<endl;
	reg(i,2,100000){
		a[i]=3*a[i-1]+2*c[i-1]+1;
		c[i]=4*a[i-1]+3*c[i-1]+2;
		if(m/10<=a[i] && a[i]<m && m/10<=a[i]+1 && a[i]+1<m && m/10<=c[i] && c[i]<m){
			cout<<a[i]<<" "<<a[i]+1<<" "<<c[i]<<endl;
			break;
		}
	}
	return 0;
}
0