結果
| 問題 | No.2177 Recurring ab | 
| コンテスト | |
| ユーザー |  _yurimoir | 
| 提出日時 | 2023-01-07 07:00:24 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 838 bytes | 
| コンパイル時間 | 3,201 ms | 
| コンパイル使用メモリ | 244,012 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-12-14 06:25:06 | 
| 合計ジャッジ時間 | 4,099 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 18 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
int32_t main(){
    ld n;
    cin>>n;
    int ans=0;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            if(i==j)continue;
            int limit=max(i,j)+1;
            // ld p1=((ld)n*i+sqrt((ld)n*n*i*i+(ld)4.0*((ld)1.0+n*j)))/(ld)2.0;
            int high,low;
            high=1e9+1;
            low=0;
            while(high-low>1){
                int mid=(high+low)/2;
                int f=mid*mid-n*i*mid-1-n*j;
                if(f<0){
                    low=mid;
                }else{
                    high=mid;
                }
            }
            // int x1=(int)p1;
            int x1=low;
            if(x1<limit)continue;
            ans+=min((int)1e9,x1)-limit+1;
        }
    }
    cout<<ans<<endl;
}
            
            
            
        