2 条题解
- 
  -13
#include <stdio.h> #include <iostream> #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; } } } - 
  -14
#include <stdio.h> #include <iostream> #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; } } } 
- 1
 
信息
- ID
 - 1000
 - 时间
 - 1000ms
 - 内存
 - 128MiB
 - 难度
 - 5
 - 标签
 - 递交数
 - 616
 - 已通过
 - 250
 - 上传者