A+B in Hogwarts (20)
水题
题目描述
If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Sickle, it's easy enough." Your job is to write a program to compute A+B where A and B are given in the standard form of "Galleon.Sickle.Knut" (Galleon is an integer in [0, 107], Sickle is an integer in [0, 17), and Knut is an integer in [0, 29)).
输入描述:
Each input file contains one test case which occupies a line with A and B in the standard form, separated by one space.
输出描述:
For each test case you should output the sum of A and B in one line, with the same format as the input.
AC代码:
#include<bits/stdc++.h>
using namespace std;struct num{int a;int b=0;
}uni[10000];int main()
{int n,len=0;cin>>n;for(int i=0;i<n;i++){int num,pd=1;cin>>num;for(int j=0;j<len;j++ ){if(num==uni[j].a) {uni[j].b++;pd=0;break;}}if(pd) {uni[len].a=num;uni[len].b++;len++;}}int x=1;for(int i=0;i<len;i++){if(uni[i].b==1) {cout<<uni[i].a;x=0;break;}}if(x) cout<<"None";return 0;
}
A+B in Hogwarts (20)相关推荐
- 1058. A+B in Hogwarts (20)
1058. A+B in Hogwarts (20) 时间限制 50 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue If you ...
- 【PAT甲级 进位相加】1058 A+B in Hogwarts (20 分) C 全部AC
题目 进位相加 题解 C #include<stdio.h> int main() {int a1, b1, c1;int a2, b2, c2;int a3, b3, c3;scanf( ...
- 1058 A+B in Hogwarts (20 分)_7行代码AC
PAT甲级最优题解-->传送门 If you are a fan of Harry Potter, you would know the world of magic has its own c ...
- PAT甲级题目翻译+答案 AcWing(高精度)
1002 A+B for Polynomials (25 分) 题意 :给两个多项式,输出两个多项式相加结果的系数和次数 思路 :用double数组记录多项式,正好数组下标是整数,系数是double ...
- 【最新合集】PAT甲级最优题解(题解+解析+代码)
以下每道题均是笔者多方对比后, 思考整理得到的最优代码,欢迎交流! 共同成长哇.可以和博主比拼一下谁刷的更快~ 欢迎收藏.欢迎来玩儿 PAT题解目录 题号 标题 题解 分类 使用算法 1001 A+B ...
- 【PAT甲级】字符串处理及进制转换专题
目录 字符串处理 PAT甲级 1001 A+B Format (20 分) PAT甲级1005 Spell It Right (20 分) PAT甲级1035 Password (20 分) PAT甲 ...
- PAT (Advanced Level) Practice 题解代码 - II (1051-1100)
PAT PAT (Advanced Level) Practice - II(1051-1100) -------------------------------------------------- ...
- 用html和js编写黑洞数,python_黑洞数
>>> def main(n): start = 10**(n-1)+2 end = start*10-20 for i in range(start,end): i = str(i ...
- 【PAT甲级】A1051-A1100刷题记录
文章目录 (栈) A1051 Pop Sequence (25 分) 0.47 (静态链表) A1052 Linked List Sorting (25 分) 0.21 (静态树+先根遍历DFS) A ...
最新文章
- IE-OLD IE 提示
- Xilium.CefGlue的入门
- org.apache.commons.lang.StringUtils
- Linux下mp3文件的乱码问题
- wordpress使用二级域名绑定七牛云存储做图片存储站
- C# WPF MVVM开发框架Caliburn.Micro 名称Transformer⑩①
- 2020过半,程序员“跳槽”还是“卧槽”,你想好了吗?
- Daily Scrum02 12.17
- linux内存管理_架构师必读:Linux 的内存分页管理
- 恒生电子:O45好在哪儿(深度)| 国君计算机李沐华
- android 音频播放插件,在android中的listview中实现音频播放器
- nginx proxy_pass 502 这是什么错误?
- 密码如何改变了我的一生
- Qt6教程之三(2) QT使用qss
- 一盘多用,Linux安装盘+window PE启动盘
- 真太极之只言片语 (续)
- 学习游戏软件开发需要哪些基础知识
- 从《亮剑》看先进的管理(原创)
- Microsoft Teams 会议室讲解
- 十、SpringCloud + Alibaba 全家桶详解(目前公司最新技术)
热门文章
- mysql 完整性概念_mysql基础知识
- 文件管理英文html,Directory Opus
- mysql 内联和外联的区别_内联查询与外联查询
- 计算机辅助管理与制造,计算机辅助设计与制造,对产品的设备进行管理,完成产品加工制造...
- spring cloud Eureka 之配置信息
- s3 java_java – 我们可以迭代Amazon S3中的完整对象集
- leetcode 354. 俄罗斯套娃信封问题(二维排序有关)
- 1269: [AHOI2006]文本编辑器editor
- java 获取日期的几天前,几个月前和几年前
- jQuery全局Ajax事件处理器