AC (2ms, 108KB)
#include <stdio.h>
#include <stdlib.h>
int n;
int a, b, c;
int space;
int main(void) {
//readin
scanf("%d", &n); //days
for(int i = 0; i < n; i++) {
//readin
scanf("%d%d%d", &a, &b, &c);
//solve
space = 0;
if(c == 1) {
printf("No free parking spaces.\n");
} else {
a++;
while(a % c != 0 && a < b) {
printf("%d ", a);
space = 1;
a++;
}
int gap = 1;
while(a + gap < b) {
printf("%d ", a + gap);
space = 1;
gap++;
if(gap == c) {
gap = 1;
a += c;
}
}
//print
if(!space) {
printf("No free parking spaces.");
}
putchar('\n');
}
}
return 0;
}
如果本文對您有幫助的話幫忙點擊廣告和分享吧!
© 若無特別註明,本站文章皆由 WeakMouse's Coding Blog 原創 ,轉載引用本文前請先留言告知。本文轉載請註明文章源自 WeakMouse's Coding Blog ,作者 ,並附上原文連結: 【題解】Zerojudge e621 - 1. 免費停車 (Free Parking)
0 留言