#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <queue>
#include <stack>
using namespace std;
const int maxn = 50+20;
const int n = 50;
int deg[maxn], G[maxn][maxn], m;
void euler(int u){
for(int v=1; v<=n; v++){ //这里是n而非m
if(G[u][v]){
G[u][v]--;
G[v][u]--;
euler(v);
printf("%d %d\n", v, u);
}
}
}
int main(){
int T, u, v, kase=0;
cin >> T;
while(T--){
cin >> m;
memset(deg, 0, sizeof(deg));
memset(G, 0, sizeof(G));
for(int i=0; i<m; i++){
cin >> u >> v;
G[u][v]++;
G[v][u]++;
deg[u]++;
deg[v]++;
}
bool flag = true;
for(int i=1; i<=n; i++){ //这里也是n非m
if(deg[i] % 2 == 1) { flag = false; break; }
}
if(kase) putchar('\n');
if(flag){
printf("Case #%d\n", ++kase);
euler(u);
}
else printf("Case #%d\nsome beads may be lost\n", ++kase);
}
return 0;
}
uva 10054
最新推荐文章于 2018-04-12 22:05:27 发布
部署运行你感兴趣的模型镜像
您可能感兴趣的与本文相关的镜像
Stable-Diffusion-3.5
图片生成
Stable-Diffusion
Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率
219

被折叠的 条评论
为什么被折叠?



