【思维】洛谷P1319 压缩技术——灵活运用for循环
P1319 压缩技术 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
题解 P1319 【压缩技术】 - RedContritio 的博客 - 洛谷博客 (luogu.com.cn)
#include<bits/stdc++.h> using namespace std; int n,p,q,t; int main() { for(cin>>n;cin>>p;t^=1){ for(;p--;q++){ if(q==n) q=0&putchar('\n'); putchar('0'+t); } } return 0; }
Keep it simple and stupid

浙公网安备 33010602011771号