Submission #64518060
Source Code Expand
Copy
#include<cstdio>#include<string>#include<algorithm>#include<iostream>using namespace std;long long a=2,b=1e9,n,l,r,mid,ans;int main() {scanf("%lld",&n);for(;a<=n;a*=2) {l=1;r=b;while(l<=r) {mid=(l+r)/2;if((2*mid-1)*(2*mid-1)*a<=n) l=mid+1;else r=mid-1;}b=r;ans+=b;}printf("%lld\n",ans);return 0;
#include<cstdio> #include<string> #include<algorithm> #include<iostream> using namespace std; long long a=2,b=1e9,n,l,r,mid,ans; int main() { scanf("%lld",&n); for(;a<=n;a*=2) { l=1; r=b; while(l<=r) { mid=(l+r)/2; if((2*mid-1)*(2*mid-1)*a<=n) l=mid+1; else r=mid-1; } b=r; ans+=b; } printf("%lld\n",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - 2^a b^2 |
User | wanglongye1 |
Language | C++ 17 (gcc 12.2) |
Score | 350 |
Code Size | 364 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3928 KB |
Compile Error
Main.cpp: In function ‘int main()’: Main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%lld",&n); | ~~~~~^~~~~~~~~~~
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 350 / 350 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example_00.txt, example_01.txt, example_02.txt |
All | example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
example_00.txt | AC | 1 ms | 3740 KB |
example_01.txt | AC | 1 ms | 3664 KB |
example_02.txt | AC | 1 ms | 3800 KB |
hand_00.txt | AC | 1 ms | 3684 KB |
hand_01.txt | AC | 1 ms | 3852 KB |
hand_02.txt | AC | 1 ms | 3788 KB |
hand_03.txt | AC | 1 ms | 3912 KB |
hand_04.txt | AC | 1 ms | 3708 KB |
hand_05.txt | AC | 1 ms | 3664 KB |
hand_06.txt | AC | 1 ms | 3788 KB |
hand_07.txt | AC | 1 ms | 3684 KB |
hand_08.txt | AC | 1 ms | 3744 KB |
hand_09.txt | AC | 1 ms | 3924 KB |
hand_10.txt | AC | 1 ms | 3896 KB |
random_00.txt | AC | 1 ms | 3744 KB |
random_01.txt | AC | 1 ms | 3924 KB |
random_02.txt | AC | 1 ms | 3828 KB |
random_03.txt | AC | 1 ms | 3784 KB |
random_04.txt | AC | 1 ms | 3784 KB |
random_05.txt | AC | 1 ms | 3856 KB |
random_06.txt | AC | 1 ms | 3792 KB |
random_07.txt | AC | 1 ms | 3668 KB |
random_08.txt | AC | 1 ms | 3748 KB |
random_09.txt | AC | 1 ms | 3676 KB |
random_10.txt | AC | 1 ms | 3800 KB |
random_11.txt | AC | 1 ms | 3924 KB |
random_12.txt | AC | 1 ms | 3924 KB |
random_13.txt | AC | 1 ms | 3776 KB |
random_14.txt | AC | 1 ms | 3928 KB |