QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#644384 | #8025. Fibonacci | gjlccc# | WA | 1ms | 3648kb | C++20 | 631b | 2024-10-16 13:41:01 | 2024-10-16 13:41:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
inline void solve() {
int n;
cin >> n;
int ans = 0;
// if (n > 3) {
// ans += 2 + (n - n % 3 - 1) * n / 3 / 2; // n % 3 == 0
// ans += (0 + (n - n % 3) / 3 - 1) * n / 3; // n % 3 != 0
// if (n % 3 == 1) ans += n / 3;
// if (n % 3 == 2) ans += n / 3 * 2;
// }
ans = n / 3 * (n - 1) - (n / 3) * (n / 3 - 1) / 2;
cout << ans << '\n';
return;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
int tt = 1;
cin >> tt;
while (tt--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3648kb
input:
1
output:
-3158691994077677635
result:
wrong answer expected '0', found '-3158691994077677635'