PAT A1023】的更多相关文章

[题目大意] 给一个不超过20位的数字,如果将它乘以2得到的数仅仅是原来的数字重新排列得到的,那就输出Yes,下一行输出加倍后的数.如果不是,输出No,下一行输出加倍后的数. [思路] 20位过于庞大,超出了long long,所以用数组来做,其中的算法核心有竖式乘法的数组计算法. [tips] 1 判断原数和double原数是否拥有同样数字的方法: 建立一个数组check[0~9],如果原数的第i位是a,则check[a]++:如果double原数的第i位是a,则check[a]--.最后检查…
简单的大数问题,long long并不能容纳21位数字,这是刚开始没有注意到的 #include<iostream> #include<stdlib.h> #include<stdio.h> #include<string> #include<cstring> #include<vector> using namespace std; using std::vector; char s[21]; int mem[10]={0}; in…
Source: PAT A1023 Have Fun with Numbers (20 分) Description: Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit…
Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in a…
PAT中关于大数的有B1017,A1023,A1024 (A-Advance,B-Basic) B1017 1017. A除以B (20) 本题要求计算A/B,其中A是不超过1000位的正整数,B是1位正整数.你需要输出商数Q和余数R,使得A = B * Q + R成立. 输入格式: 输入在1行中依次给出A和B,中间以1空格分隔. 输出格式: 在1行中依次输出Q和R,中间以1空格分隔. 输入样例: 123456789050987654321 7 输出样例: 1763668415014109347…
专题一  字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d",&a,&b); sum=a+b; ) { printf ("-"); sum=-sum; } ; ) { s[top++]=; } ) { s[top++]=sum%; sum/=; } ;i>=;i--) { printf ("%d"…
博客出处:http://blog.csdn.net/zhoufenqin/article/details/50497791 题目出处:https://www.patest.cn/contests/pat-a-practise 1001 题意:给出a+b,计算c=a+b,将c输出时每三个数加一个“,” 思路:数据范围比较小,根据特殊的数据范围,也可特殊求解,不解释 #include<iostream> #include<cstdio> #include<cstring>…
原题连接:https://pta.patest.cn/pta/test/16/exam/4/question/677 题目如下: The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT. Input Specification: Each…
B1024. 科学计数法 (20) Description: 科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+-][1-9]"."[0-9]+E[+-][0-9]+,即数字的整数部分只有1位,小数部分至少有1位,该数字及其指数部分的正负号即使对正数也必定明确给出. 现以科学计数法的格式给出实数A,请编写程序按普通数字表示法输出A,并保证所有有效位都被保留. Input: 每个输入包含1个测试用例,即一个以科学计数法表示的实数A.该数字的存储长度不超过99…
每个PAT考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位.正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考试座位就座.但有些考生迟到了,试机已经结束,他们只能拿着领到的试机座位号码求助于你,从后台查出他们的考试座位号码. 输入格式: 输入第一行给出一个正整数N(<=1000),随后N行,每行给出一个考生的信息:"准考证号 试机座位号 考试座位号".其中准考证号由14位数字组成,座位从1到N编…