QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#378698#8025. Fibonaccicomeintocalm#WA 1ms3596kbC++20415b2024-04-06 14:15:072024-04-06 14:15:08

Judging History

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

  • [2024-04-06 14:15:08]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3596kb
  • [2024-04-06 14:15:07]
  • 提交

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'