結果

問題 No.3156 Count That Day's N
ユーザー HoIa_lion
提出日時 2025-05-23 20:34:16
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 692 bytes
コンパイル時間 1,775 ms
コンパイル使用メモリ 195,528 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-05-23 20:34:23
合計ジャッジ時間 6,144 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 2
other AC * 2 RE * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int64_t doc(int64_t n,int64_t k){
	vector<int64_t> v(n,0);
	int x=1;
	while(x*x*x*x<=n){
		int y=1;
		int64_t z=x*x*x*x+y*y*y*y*y*y;
		//cout << z << endl;
		while(z<=n){
			int64_t s=1,t=z;
			while(t-s>1){
				int64_t c=(t+s)/2;
				if(k*c*c>z){
					t=c;
				}
				else{
					s=c;
				}
			}//s=floor(sqrt(z/k))
			//cout << s << endl;
			if(k*s*s==z){
				int i=0;
				while(v.at(i)!=0){
					if(v.at(i)==z){
						z=0;
					}
					i++;
				}
				v.at(i)=z;
			}
			y++;
			z=x*x*x*x+y*y*y*y*y*y;
		}
		x++;
	}
	int ans=0;
	while(v.at(ans)!=0){
		ans++;
	}
	return ans;
}
int main(){
	int64_t k,n;
	cin >> k >> n;
	cout << doc(n,k) << endl;
}
0