当前位置:网站首页>刷题-洛谷-P1200 你的飞碟在这儿Your Ride Is Here
刷题-洛谷-P1200 你的飞碟在这儿Your Ride Is Here
2022-08-04 19:44:00 【宋向上_UP】
P1200 你的飞碟在这儿Your Ride Is Here-C语言
1、题目

2、求解过程
(1)第一次 没有考虑到字符个数不到六个的情况
结果:
代码:
//洛谷 P1200 你的飞碟在这儿Your Ride Is Here
#include <stdio.h>
#define NUM 7 //一定要注意字符串结束符'\0'
int main() {
char temp;
int star=1;//彗星
int ranks=1;//队伍
int i;
for (i = 0; i < NUM; i++) {
scanf("%c", &temp);
if (temp >= 'A' && temp <= 'Z') {
star = star * (temp - 64);
}
}
star = star % 47;
//printf("%d", star);
for (i = 0; i < NUM; i++) {
scanf("%c", &temp);
if (temp >= 'A' && temp <= 'Z') {
ranks = ranks * (temp - 64);
}
}
ranks = ranks % 47;
//printf("%d %d", star,ranks);
if (star == ranks) {
printf("GO");
}
else {
printf("STAY");
}
return 0;
}
(2)第二次
结果:
代码:
//洛谷 P1200 你的飞碟在这儿Your Ride Is Here
#include <stdio.h>
#define NUM 7 //一定要注意字符串结束符'\0'
int main() {
char temp;
int star=1;//彗星
int ranks=1;//队伍
int i;
for (i = 0; i < NUM; i++) {
scanf("%c", &temp);
if(temp=='\n'){
break;
}
if (temp >= 'A' && temp <= 'Z') {
star = star * (temp - 64);
}
}
star = star % 47;
//printf("%d", star);
for (i = 0; i < NUM; i++) {
scanf("%c", &temp);
if(temp=='\n'){
break;
}
if (temp >= 'A' && temp <= 'Z') {
ranks = ranks * (temp - 64);
}
}
ranks = ranks % 47;
//printf("%d %d", star,ranks);
if (star == ranks) {
printf("GO");
}
else {
printf("STAY");
}
return 0;
}
边栏推荐
- 泰山OFFICE技术讲座:底纹、高亮、边框的关系
- Differences in the working mechanism between SAP E-commerce Cloud Accelerator and Spartacus UI
- How to add custom syntax to MySQL?
- awk statistical average max min
- 《支付宝体验设计精髓》一书,跟测试相关性知识记录
- NLP技术为何在工业界这么卷?前沿案例解析来了
- 正则表达式未完
- The list of Kubernetes - watch mechanism
- 工业相机CCD与CMOS
- SAP UI5 ensures that the control id is globally unique implementation method
猜你喜欢
随机推荐
Internship: changed the requirements
笔记本WIFI无法上网(无Internet访问权限)
泰山OFFICE技术讲座:底纹、高亮、边框的关系
正畸MIA微种植体支抗技术中国10周年交流会在沈举办
小波提取特征的VQ实现
Differences in the working mechanism between SAP E-commerce Cloud Accelerator and Spartacus UI
Zip4j使用
SIGIR 2022 | 邻域建模Graph-Masked Transformer,显著提高CTR预测性能
The difference between Client Side Cache and Server Side Cache
Go study notes (Part 1) Configuring the Go development environment
QCustomPlot 坐标轴间隔显示刻度标签
"WAIC 2022 · hackers marathon" two ants wealth competition invited you to fight!
程序员如何在职场上少走弯路?
密码学系列之:PEM和PKCS7,PKCS8,PKCS12
奥拉时钟芯片生成配置文件脚本
[Sql brush topic] Query information data--Day1
really time ntp service start command
红外图像滤波
带你了解数据分布式存储原理
[Latest Information] 2 new regions will announce the registration time for the soft exam in the second half of 2022








