3 条题解

  • 0
    @ 2026-4-12 19:26:12

    #include <stdio.h> #include #include <string.h> using namespace std; int a[1010]; int main() { int n; cin >> n; int sum = n; int cnt = 0; int f = 1; for(int i = 1 ; i >= 1 && i <= n ; i += f) { if(a[i] == 0) { cnt++; if(sum == 2) { cout << i << endl; break; } if(cnt%3 == 0) { sum--; a[i] = 1; } } if( (i == 1 && f == -1) || (i == n && f == 1) ) { cnt = 0; if(a[i]==0) cnt = 1; f = -f; } } }


    信息

    ID
    1000
    时间
    1000ms
    内存
    128MiB
    难度
    5
    标签
    递交数
    624
    已通过
    255
    上传者