QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#644384#8025. Fibonaccigjlccc#WA 1ms3648kbC++20631b2024-10-16 13:41:012024-10-16 13:41:01

Judging History

你现在查看的是最新测评结果

  • [2024-10-16 13:41:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3648kb
  • [2024-10-16 13:41:01]
  • 提交

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'