把分就这么轻易的全全给你!ACM的一题目1075 Set Me!!

wengsczx 2005-07-31 04:02:47
先不要说这题目怎么做,就说说他的输出格式吧
我PE了N次,
我做了就是输出格式不知道哪错了?做过这题目的大虾给点提醒呀
谢谢!!
原文在
http://acm.zju.edu.cn/show_problem.php?pid=1075
Set Me

--------------------------------------------------------------------------------

Time limit: 1 Seconds Memory limit: 32768K
Total Submit: 968 Accepted Submit: 259
Problem

The game of Set is played with a deck of eighty-one cards, each having the following four characteristics:

Symbol: diamonds, ovals, or squiggles
Count: 1, 2, or 3 symbols
Color: red, green, or purple
Shading: outlined, filled, or striped

The cards are shuffled and a tableau of twelve cards is laid out. Players then attempt to be the first to identify "Sets" which exist in the tableau. Sets are removed as they are identified and new cards are dealt in their place. Play continues in this manner until all cards have been used. The winner is the player with the most sets.

A set is a collection of three cards in which each characteristic is either the same on all three cards or different on all three cards. For example, the cards shown below form a set.



To see how the cards above form a set, take each characteristic in turn. First, each card has different symbol: the first card has squiggles, the second diamonds, and the third ovals. Second, each card has the same count of symbols, three. Third each card has a different color, and finally, each card has a different shading. Thus, each characteristic is either the same on all three cards or different on all three cards, satisfying the requirement for a set.

Consider the following example of three cards which do not form a set.



Again, take each characteristic in turn. Each card has a different symbol, each card has a different count of symbols, and each card is the same color. So far this satisfies the requirements for a set. When the shading characteristic is considered, however, two cards are filled and one card is striped. Thus, the shading on all three cards is neither all the same nor all different, and so these cards do not form a set.

The input for this program consists of several tableaus of cards. The tableaus are listed in the input file one card per line, with a single blank line between tableaus. The end of the input is marked by the end of the file. Each card in a tableau is specified by four consecutive characters on the input line. The first identifies the type of symbol on the card, and will be either a "D", "O", or "S", for Diamond, Oval, or Squiggle, respectively. The second character will be the digit 1, 2, or 3, identifying the number of symbols on the card. The third identifes the color and will be an "R", "G", or "P" for Red, Green, or Purple, respectively. The final character identifes the shading and will be an "O", "F", or "S" for Outlined, Filled, or Striped. All characters will be in uppercase.


Output

The output for the program is, for each tableau, a list of all possible sets which could be formed using cards in the tableau. Your output should adhere to the format illustrated by the example below. Sort on the first card with the order it appears in the input, break possible ties with the second card, then the third. In the event that no sets exist in a tableau, report "*** None Found ***".

There is a blank line between adjacent cases.


Example

Input

S1PS
D3PO
S2GF
O2GS
O2GF
O3PO
S2RF
S3GS
D2GS
O1GS
O1GF
S2PS

O2GF
O1PF
D2PO
D3RO
S2PO
O1GF
O1GS
D2GO
S3PF
S2GF
D2GS
S1RS

Output

CARDS: S1PS D3PO S2GF O2GS O2GF O3PO S2RF S3GS D2GS O1GS O1GF S2PS
SETS: 1. D3PO S2RF O1GS
2. S3GS D2GS O1GS

CARDS: O2GF O1PF D2PO D3RO S2PO O1GF O1GS D2GO S3PF S2GF D2GS S1RS
SETS: *** None Found ***
就这样.
...全文
291 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
wengsczx 2005-08-02
  • 打赏
  • 举报
回复
回复人:lw1a2(一刀) () 信誉:101 2005-7-31 17:42:43 得分: 5 删除

读完它需要很多时间

回复人:zcm9900(Zzzzz) () 信誉:100 2005-7-31 20:07:29 得分: 30 删除

这题是简单题,PE无非是多些空格回车之类的,注意最后不要多空格

回复人:SeedJYH(冰火梦幻) () 信誉:100 2005-8-1 0:07:52 得分: 30 删除

搂主,你中计了……
那句*** None Found ***后面是没有空格的,直接换行
看一下http://acm.pku.edu.cn/JudgeOnline/showproblem?problem_id=1053就知道了
回复人:jixingzhong(瞌睡虫) () 信誉:100 2005-8-2 8:17:25 得分: 5 删除

呵呵


看来是这样呀 ...


楼主小心陷阱 哈哈


回复人:xiao_xiao_zi(笑小子) () 信誉:100 2005-8-2 8:30:50 得分: 30 删除

There is a blank line between adjacent cases.
最后一句不要有空行
判断当前是不是最后一个case就OK了
很多题目都这样的
有时候ZJU和PKU会有一点格式上的不同
有时候连数据量都不同
真是受不了~~


我本是都给你们加的.给果点给分后它出现了无法显示,真的真的不好意思了.这已经是我第二次碰到了,
知道我哪操作错的请指教一下,
wengsczx 2005-08-02
  • 打赏
  • 举报
回复
我自己已经解决了,散分,人人有份
xiao_xiao_zi 2005-08-02
  • 打赏
  • 举报
回复
There is a blank line between adjacent cases.
最后一句不要有空行
判断当前是不是最后一个case就OK了
很多题目都这样的
有时候ZJU和PKU会有一点格式上的不同
有时候连数据量都不同
真是受不了~~
jixingzhong 2005-08-02
  • 打赏
  • 举报
回复
呵呵


看来是这样呀 ...


楼主小心陷阱 哈哈
冰火梦幻 2005-08-01
  • 打赏
  • 举报
回复
搂主,你中计了……
那句*** None Found ***后面是没有空格的,直接换行
看一下http://acm.pku.edu.cn/JudgeOnline/showproblem?problem_id=1053就知道了
wengsczx 2005-08-01
  • 打赏
  • 举报
回复
Output

The output for the program is, for each tableau, a list of all possible sets which could be formed using cards in the tableau. Your output should adhere to the format illustrated by the example below. Sort on the first card with the order it appears in the input, break possible ties with the second card, then the third. In the event that no sets exist in a tableau, report "*** None Found ***".

There is a blank line between adjacent cases
zju比pku多了最后一句主要要考虑最后一组输出时的换行怎么去掉?
代码:
#include<iostream>
using namespace std;

char a[12][4];
int fun(int i,int j,int k,int n)
{
if(a[i][n]!=a[j][n]&&a[i][n]!=a[k][n]&&a[j][n]!=a[k][n])
return 1;
if(a[i][n]==a[j][n]&&a[i][n]==a[k][n]&&a[j][n]==a[k][n])
return 1;
return 0;
}
int main()
{
int i,j,k,m,fun(int,int,int,int);

while(1)
{
m=0;
if(scanf("%s",a[0])==EOF)
break;
for(i=1;i<12;i++)
cin>>a[i];
cout<<"CARDS: ";
for(i=0;i<12;i++)
{
cout<<" ";
printf("%.4s",a[i]);
}
cout<<endl;
cout<<"SETS: ";
for(i=0;i<12;i++)
{
for(j=i+1;j<12;j++)
{
for(k=j+1;k<12;k++)
{
if(fun(i,j,k,0))
if(fun(i,j,k,1))
if(fun(i,j,k,2))
if(fun(i,j,k,3))
{

m++;
if(m==1)
{
cout<<m<<". ";
printf("%.4s",a[i]);
cout<<" ";
printf("%.4s",a[j]);
cout<<" ";
printf("%.4s",a[k]);
cout<<endl;
}
else
{
if(m<=9)
cout<<" "<<m<<". ";
else
cout<<" "<<m<<". ";
printf("%.4s",a[i]);
cout<<" ";
printf("%.4s",a[j]);
cout<<" ";
printf("%.4s",a[k]);
cout<<endl;
}
}
}
}
}
if(m==0)
cout<<"*** None Found ***"<<endl;
cout<<endl;
}
return 0;
}
wengsczx 2005-08-01
  • 打赏
  • 举报
回复
wengsczx 1053 Accepted
我在http://acm.pku.edu.cn/JudgeOnline/showproblem?problem_id=1053
就对了,
有http://acm.zju.edu.cn/show_problem.php?pid=1075
wengsczx 1075 Presentation Error
怎么会这样?
wengsczx 2005-08-01
  • 打赏
  • 举报
回复
SeedJYH(冰火梦幻)
能否给个代码看看,我那句*** None Found ***后面是没有空格的,直接换行
是这样做的,就是还是那样

不知道我其它哪格式错了,
就是最后一遍完时要不要有空行的?
让你讲可能难讲就看看你对的代码我就清楚了哪错了
谢谢
zcm9900 2005-07-31
  • 打赏
  • 举报
回复
这题是简单题,PE无非是多些空格回车之类的,注意最后不要多空格
lw1a2 2005-07-31
  • 打赏
  • 举报
回复
读完它需要很多时间
wengsczx 2005-07-31
  • 打赏
  • 举报
回复
快伸出援助之手吧,
谢谢

3,882

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧