QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#378698 | #8025. Fibonacci | comeintocalm# | WA | 1ms | 3596kb | C++20 | 415b | 2024-04-06 14:15:07 | 2024-04-06 14:15:08 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
LL n;
cin >> n;
LL l1 = n % 3;
LL l2 = n - l1;
LL ans = 0;
ans += (l2 - 3) * l2 / 6;
ans += l2 / 3 * l1;
// 3i
LL l3 = l2 / 3;
ans += l3 * (l3 + 1);
//ans += (l1 == 2);
//
if(n == 1) cout << "0";
else if(n == 2) cout << "1";
else if(n == 3) cout << "2";
else cout << ans;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3532kb
input:
1
output:
0
result:
ok answer is '0'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3596kb
input:
2
output:
1
result:
wrong answer expected '0', found '1'