2 条题解
-
1
#include<bits/stdc++.h> using namespace std; #define fi first #define se second #define lowbit(x) ((x)&(-x)) #define ll long long const int N=1005; int a[N]; int main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; int dj=0,yh=0,xz=0; //能量,永恒,心之 for(int i=1;i<=n;i++){ if(yh==1){ yh=0; xz++; } dj+=a[i]; if(dj<6) continue; if(dj/6%2||i==n){ yh+=dj/6; xz+=yh/2; dj%=6; yh%=2; } else{ yh+=(dj-6)/6; xz+=yh/2; dj=6; yh%=2; } } cout<<xz; }
信息
- ID
- 959
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- 递交数
- 339
- 已通过
- 45
- 上传者