标签:输出 评测 pre lag using lse 简单 color pac
#include <iostream> using namespace std; int main() { //flag[]表示每排空位的个数 int n,a[101],seat[21][6],flag[21]; cin >> n; for(int i = 1;i <= n;i++) { cin >> a[i]; } for(int i = 1;i <= 20;i++) { flag[i] = 5; } for(int i = 1;i <= 20;i++) { for(int j = 1;j <= 5;j++) { seat[i][j] = (i-1)*5+j; } } for(int i = 1;i <= n;i++) { for(int j = 1;j <= 20;j++) { if(a[i] <= flag[j]) { while(a[i]--) { if(a[i] == 0) { cout << seat[j][6-flag[j]] << ‘\n‘; flag[j]--; } else { cout << seat[j][6-flag[j]] << ‘ ‘; flag[j]--; } } break; } } } for(int i = 1;i <= n;i++) { if(a[i] > 0) { for(int j = 1;j <= 20;j++) { while(flag[j] > 0 && a[i] > 0) { if(a[i] == 1) { cout << seat[j][6-flag[j]] << "\n"; flag[j]--; a[i]--; } else { cout << seat[j][6-flag[j]] << " "; flag[j]--; a[i]--; } } if(a[i] == 0) { break; } } } } return 0; }
标签:输出 评测 pre lag using lse 简单 color pac
原文地址:https://www.cnblogs.com/Lazy-Cat/p/9997908.html