結果
| 問題 |
No.2177 Recurring ab
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2023-01-06 21:49:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 593 bytes |
| コンパイル時間 | 2,067 ms |
| コンパイル使用メモリ | 194,180 KB |
| 最終ジャッジ日時 | 2025-02-09 23:50:15 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 4 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
ll sqr(ll x){
ll tmp=sqrt(x);
if((tmp+1)<=x/(tmp+1)) return tmp+1;
if(tmp<=x/tmp) return tmp;
return tmp-1;
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n;
cin>>n;
ll ans=0;
for(int a=0;a<10;a++){
for(int b=0;b<10;b++){
if(a==b) continue;
ll tmp=(a*n+sqr(a*a*n*n+4+4*b*n))/2;
if(tmp<=max(a,b)) continue;
ans+=tmp-max(a,b);
}
}
cout<<ans<<endl;
return 0;
}
umezo