結果
| 問題 | No.3156 Count That Day's N | 
| コンテスト | |
| ユーザー |  Ponzu | 
| 提出日時 | 2025-05-29 20:13:10 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 31 ms / 3,000 ms | 
| コード長 | 563 bytes | 
| コンパイル時間 | 1,368 ms | 
| コンパイル使用メモリ | 112,080 KB | 
| 実行使用メモリ | 7,844 KB | 
| 最終ジャッジ日時 | 2025-05-29 20:13:14 | 
| 合計ジャッジ時間 | 3,780 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 32 | 
ソースコード
#include<iostream>
#include<vector>
#include<math.h>
#include<set>
using namespace std;
long long fx(long long x){
	return x * x * x * x * x * x;
}
long long fy(long long y){
	return y * y * y * y;
}
int main(){
	long long K,N;
	cin>>K>>N;
	int count = 0;
	set<long long> st;
	for(long long x=1;x<=1000;++x){
		for(long long y=1;y<=10000;++y){
			long long res = (fx(x) + fy(y));
			if(N < res) continue;
			if(res % K) continue;
			res /= K;
			long long sq = sqrtl(res);
			
			if(sq*sq == res ){
				st.emplace(res);
			}
		}
	}
	cout << st.size() << endl;
}
            
            
            
        