Yet Another Ball Problem CodeForces - 1118E (简单构造)

大意: 求构造n个pair, 每个pair满足

Yet Another Ball Problem CodeForces - 1118E  (简单构造)

对于每k组, 让$b_i$为$[1,k]$, $g_i$循环右移就好了

int n, k, cnt;

int main() {
scanf("%d%d", &n, &k);
if (n>(ll)k*(k-1)) return puts("NO"),0;
puts("YES");
int cnt = 0;
REP(i,1,n) {
int cur = i+1;
REP(j,1,k) {
printf("%d %d\n",j,cur);
if (++cnt==n) return 0;
if (++cur==k+1) cur = 1;
}
}
}
上一篇:JavaEE Tutorials (21) - Java EE安全:高级主题


下一篇:Rake::TestTask 介绍