工大后院

 找回密码
 加入后院

扫一扫,访问微社区

QQ登录

只需一步,快速开始

搜索
查看: 1847|回复: 10

ACM讨论

[复制链接]
发表于 2006-12-24 00:52 | 显示全部楼层 |阅读模式
讨论帖……
发表于 2006-12-24 11:00 | 显示全部楼层
顶                顶下
回复

使用道具 举报

 楼主| 发表于 2006-12-24 11:27 | 显示全部楼层
谢谢帮顶 - -#
回复

使用道具 举报

 楼主| 发表于 2006-12-24 11:30 | 显示全部楼层
昨晚一个PE浪费了N多时间....
找别人的代码一看,少了几个  \n    - -#
英语水平还是要提高……
回复

使用道具 举报

 楼主| 发表于 2006-12-24 14:18 | 显示全部楼层
Description
Winter has come, but at the Ural State University heating is not turned on yet. There's one little problem: the University is heated only if all of the valves are opened. There are some technicians at the University. Each of them is responsible for one or more valves. There may be several technicians responsible for the same valve. When a technician gets an instruction to turn on the heating he goes round all of his valves and turns them. It means that if a valve was opened then he closes it, and if it was closed then he opens it. It is well known that every technician earns his money not in vain so it's impossible to replace any technician by any combination of other technicians.
Your task is to determine who of the technicians is to get an instruction "to turn on the heating" in order to heat all the Ural State University. Note that there are N technicians and N valves at the University (1 <= N <= 250).

Input
The first line of an input contains the number N. The next N lines contain lists of the valves in charge of each of the technicians. It means that a line number i + 1 contains numbers of the valves that the i-th technician is responsible for. Each list of valves is followed by –1.
Output
An output should contain a list of technicians' numbers sorted in ascending order. If several lists are possible, you should send to an output the shortest one. If it's impossible to turn on the heating at the University, you should write "No solution" .

Sample Input

4
1 2 -1
2 3 4 -1
2 -1
4 -1

Sample Output

1 2 3

Source
Ural State University Internal Contest October'2000 Students Session


意译:
冬天来了,但USU的供热系统没有开启,因为开热气系统的阀门没有打开,
负责开阀的技术员有若干个,
而且他们负责的阀数量不一定,并且,同一个阀,有可能会有不止一个技术员负责
如果给一个技术员下命令去操作阀,
他会把阀的状态扭转(比如,本来阀是关的,他就打开,反之,就关闭),
(好傻的技术员 - -#)

现在提供技术员负责的阀的编号与阀的总数,请给出能使热气系统运行的方案(指派哪些技术员去操作气阀)
(阀的数量与技术员数量相同)

输入:第一个数为阀的数量(同时也是技术员的数量),不大于250
接着每一行第一个数为技术员的编号,其后跟着的是此技术员负责的阀的编号,以 -1表示结束

输出:解决方案的所有技术员的编号,以空格格开

输入输出例见E文..

[ 本帖最后由 iptton 于 2006-12-24 15:08 编辑 ]
回复

使用道具 举报

 楼主| 发表于 2006-12-24 15:07 | 显示全部楼层
有点想法是:1,0矩阵....
回复

使用道具 举报

发表于 2006-12-25 14:33 | 显示全部楼层
支持下!!!!
英语四级不过就是这样,.看题都好难,,,,深有感受!要加油了
回复

使用道具 举报

发表于 2006-12-27 00:22 | 显示全部楼层
1151题交了好多次,都是Runtime Error
SIGSEGV
格式..............
回复

使用道具 举报

 楼主| 发表于 2006-12-27 01:16 | 显示全部楼层
英文最长的字符好像有三十多个词
无聊题...

下面代码不可行....
死循环:kiss:
没想到怎么判断换行...




  1. #include <stdio.h>
  2. int main(){
  3.   int n;
  4.   int m;
  5.   int l;
  6.   char c[35];
  7.   scanf("%d",&n);
  8.   while(n--){
  9.     scanf("%d",&m);
  10.     while(m-->0){
  11.       scanf("%s",c);
  12.       l=strlen(c);
  13.       if(strcmp(c,"\r")==0 && m>0)printf("\n");
  14.       else{
  15.         while(l-->0)printf("%c",c[l]);
  16.       }
  17.     }
  18.     if(n!=0)printf("\n");
  19.   }
  20. }
复制代码

[ 本帖最后由 iptton 于 2006-12-27 01:22 编辑 ]
回复

使用道具 举报

发表于 2006-12-27 01:35 | 显示全部楼层
换行?你说一行的结尾吧? '\0'
qq有问题............
回复

使用道具 举报

发表于 2006-12-27 01:43 | 显示全部楼层
换行?你说一行的结尾吧? '\0'
qq有问题............
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入后院

本版积分规则

QQ|Archiver|手机版|小黑屋|广告业务Q|工大后院 ( 粤ICP备10013660号 )

GMT+8, 2024-5-31 11:14

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表