akly
C++博客
::
首页
::
联系
::
聚合
::
管理
1 Posts :: 0 Stories :: 0 Comments :: 0 Trackbacks
常用链接
我的随笔
我的评论
我参与的随笔
留言簿
给我留言
查看公开留言
查看私人留言
我参与的团队
随笔分类
C++
USACO(1)
随笔档案
2008年12月 (1)
收藏夹
c++
搜索
最新评论
USACO: Your Ride Is Here
Examples:
Input
OutPut
COMETQ
HVNGAT
GO
ABSTAR
USACO
STAY
Code:
1
/**/
/*
2
ID: yy2alan2
3
PROG: ride
4
LANG: C++
5
*/
6
#include
<
fstream
>
7
#include
<
string
>
8
#include
<
cstring
>
9
10
using
namespace
std;
11
12
int
main( )
{
13
ofstream fout(
"
ride.out
"
);
14
ifstream fin(
"
ride.in
"
);
15
const
int
MaxLen
=
10
;
16
char
cometName[MaxLen
+
1
];
17
char
groupName[MaxLen
+
1
];
18
fin.getline(cometName, MaxLen);
19
fin.getline(groupName, MaxLen);
20
int
cometLen
=
strlen(cometName);
21
int
groupLen
=
strlen(groupName);
22
int
cometNum
=
1
;
23
int
groupNum
=
1
;
24
for
(
int
i
=
0
; i
<
cometLen; i
++
)
25
cometNum
=
cometNum
*
(cometName[i]
-
'
A
'
+
1
);
26
for
(
int
i
=
0
; i
<
groupLen; i
++
)
27
groupNum
=
groupNum
*
(groupName[i]
-
'
A
'
+
1
);
28
if
( groupNum
%
47
==
cometNum
%
47
)
{
29
fout
<<
"
GO
"
<<
endl;
30
}
else
{
31
fout
<<
"
STAY
"
<<
endl;
32
}
33
fout.close();
34
fin.close();
35
return
0
;
36
}
37
posted on 2008-12-03 22:01
akly
阅读(1305)
评论(0)
编辑
收藏
引用
所属分类:
USACO
只有注册用户
登录
后才能发表评论。
【推荐】100%开源!大型工业跨平台软件C++源码提供,建模,组态!
网站导航:
博客园
IT新闻
BlogJava
知识库
博问
管理
Copyright @ akly
Powered by:
.Text
and
ASP.NET
Theme by:
.NET Monster