QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#391922 | #8025. Fibonacci | SocialPanda | WA | 744ms | 3720kb | C++23 | 453b | 2024-04-16 21:54:13 | 2024-04-16 21:54:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,ans=0;
cin>>n;
int cnta=n/3;//^
int cntb=2*(n/3)+n%3;//!
for(int i=1;i<=n;i++)
{
//cout<<i<<' '<<cnta<<' '<<cntb<<endl;
if(i%3!=0)
{
cntb--;
ans+=cnta;
}
else
{
cnta--;
ans+=cntb+cnta;
}
}
cout<<ans<<endl;
}
//1 1 2 3 5 8
// 3 2 1
//1 2 3 4 5 6 7 8 9 10
//! ! ^ ! ! ^ ! ! ^ !
//! ! ^ ! ! ^ ! ! ^ !
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
input:
1
output:
0
result:
ok answer is '0'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
2
output:
0
result:
ok answer is '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
3
output:
2
result:
ok answer is '2'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
4
output:
3
result:
ok answer is '3'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
5
output:
4
result:
ok answer is '4'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
6
output:
9
result:
ok answer is '9'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
7
output:
11
result:
ok answer is '11'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
8
output:
13
result:
ok answer is '13'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
9
output:
21
result:
ok answer is '21'
Test #10:
score: -100
Wrong Answer
time: 744ms
memory: 3672kb
input:
1000000000
output:
-1279057095
result:
wrong answer expected '277777777388888889', found '-1279057095'