QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#317513 | #8167. Yet Another Simple Math Problem | ucup-team197# | WA | 0ms | 3600kb | C++14 | 634b | 2024-01-29 03:26:10 | 2024-01-29 03:26:10 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
ll n;
string aespa="TTPC";
string s[4];
ll m[4];
const int N=1e6+5;
ll f1[N],f2[N];
ll tot[N],acc[N];
ll ord[N];
ll g1,g2,gg;
ll gcd(ll x,ll y){
if(y==0) return x;
return gcd(y,x%y);
}
int main(){
ios::sync_with_stdio(false);cin.tie(0);
int t;cin >> t;
while(t--){
ll n;cin >> n;
ll l=0,r=1e9;
while(l!=r){
ll mid=(l+r+1)/2;
if(mid*mid<=n) l=mid;
else r=mid-1;
}
ll ans=(l-1)*(l-1);
ll frog=n-l*l;
if(frog>=l) ans+=2*l+1;
else ans+=2*frog;
cout << ans << '\n';
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3600kb
input:
3 6 1 101
output:
6 0 83
result:
wrong answer 1st words differ - expected: '4', found: '6'