PAT
Reticent_Man
我本微末凡尘,可也心向天空。
展开
-
(甲)1018 Public Bike Management
题目描述 There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and return it to any other stations i...原创 2020-03-29 23:30:14 · 142 阅读 · 0 评论 -
(甲) 1093 Count PAT's
The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters. Now ...原创 2018-10-11 19:38:18 · 99 阅读 · 0 评论 -
(甲) 1002 A+B for Polynomials
This time, you are supposed to find A+B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occupies 2 lines, and each line contains the informa...原创 2018-09-30 21:40:15 · 298 阅读 · 0 评论 -
(甲)1001 A+B Format
Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits). Input Specification: Each input ...原创 2018-09-30 21:22:32 · 163 阅读 · 0 评论 -
(甲)1008 Elevator
#include <iostream> using namespace std; int main() { int n,a[101]; cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; } int sum=a[0]*6; for(int i=1;i<n;i++) { int t=a[i]-a[...原创 2018-06-19 12:17:39 · 142 阅读 · 0 评论 -
(甲)1006 Sign In and Sign Out
#include <iostream> #include <cstring> using namespace std; struct student { char id[16]; char ftime[9]; char ltime[9]; }; int main() { int n; cin>>n; student a[201]; for(int ...原创 2018-06-19 12:17:32 · 141 阅读 · 0 评论 -
(甲)1005 Spell It Right
#include <iostream> #include <cstring> using namespace std; int change(int m) { switch(m) { case 0:cout<<"zero"; break; case 1:cout<<"one"; break; case 2:cout<&a原创 2018-06-19 12:17:25 · 123 阅读 · 0 评论 -
(乙)1083 是否存在相等的差
#include <iostream> #include <cstring> #include <cmath> using namespace std; int main() { int n,a[10010],b[10010],maxx=0; cin>>n; memset(a,0,sizeof(a)); memset(a,0,sizeof(...原创 2018-06-22 22:17:25 · 301 阅读 · 0 评论 -
(甲) 1101 Quick Sort
There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot are moved to its le...原创 2018-10-11 20:12:10 · 147 阅读 · 0 评论 -
(甲) 1069 The Black Hole of Numbers
For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by takin...原创 2018-10-11 21:23:19 · 184 阅读 · 0 评论 -
甲 1053 Path of Equal Weight
题目描述 Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the pa...原创 2018-12-21 21:34:39 · 133 阅读 · 0 评论 -
(甲)1025 PAT Ranking
Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists w...原创 2018-10-08 21:26:09 · 171 阅读 · 0 评论 -
(甲)1059 Prime Factors
Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1k1×p2k2×⋯×pmkm. Input Specification: Each input file co...原创 2018-10-14 21:24:50 · 157 阅读 · 0 评论 -
(甲)1003 Emergency
As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the l...原创 2018-10-07 21:53:56 · 237 阅读 · 4 评论 -
(乙)1082 射击比赛
#include <iostream> using namespace std; int main() { int n,a[10001],x[10001],y[10001],maxx=0,minn=30000,b,c; cin>>n; for(int i=0;i<n;i++) { cin>>a[i]>>x[i]>>y[i...原创 2018-06-22 22:17:33 · 164 阅读 · 0 评论 -
(乙)1081 检查密码
#include <iostream> #include <cstring> using namespace std; int main() { int n; char a[81]; cin>>n; while(n--) { int x=0,y=0; memset(a,0,sizeof(a)); cin>>a; if(str...原创 2018-06-22 22:17:40 · 283 阅读 · 0 评论 -
(乙)1013 数素数
#include <iostream> #include <cmath> using namespace std; int main() { int m,n,sum=0,x=2; cin>>m>>n; while(sum!=n) { int ok=1; for(int i=2;i<=sqrt(x);i++) { if(...原创 2018-06-18 21:19:11 · 421 阅读 · 0 评论 -
(乙)1012 数字分类
#include <iostream> #include <iomanip> using namespace std; int main() { int n,a[1001],a1=0,a2=0,a3=0,a4=0,a5=0,sum=0; cin>>n; int t=0,b[1001]; for(int i=0; i<n; i++) { c...原创 2018-06-18 21:18:15 · 192 阅读 · 0 评论 -
(乙)1011 A+B和C
#include <iostream> using namespace std; int main() { int T; long long a,b,c; cin>>T; for(int i=1;i<=T;i++) { cin>>a>>b>>c; cout<<"Case #"&原创 2018-06-18 21:17:38 · 120 阅读 · 0 评论 -
(乙)1009 说反话
/*#include<cstdio> int main(){ int num = 0; //单词的个数 char ans[80][80]; while(scanf("%s", ans[num]) != EOF){ //一直输入直到文件末尾 num++; //单词的个数加 1 } for(int i = nu...原创 2018-06-18 21:16:42 · 164 阅读 · 0 评论 -
(乙)1008 数组元素循环右移问题
#include <iostream> #include <cstring> using namespace std; int main() { int n,m,a[101]; cin>>n>>m; m=m%n; for(int i=0;i<n;i++) { cin>>a[i]; } int sum=0; for...原创 2018-06-18 21:15:56 · 116 阅读 · 0 评论 -
(乙)1005 继续(3n+1)猜想
#include <iostream> #include <algorithm> using namespace std; int main() { int n,a[200],b[900]={0},c[500]={0}; cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; } sort(a,a...原创 2018-06-18 21:14:56 · 117 阅读 · 0 评论 -
(乙)1003 我要通过!
#include <iostream> #include <cstring> using namespace std; int maxx=0,minn=9999999,cnt; int n,m,c1,c2,man[501],a[501],b[501],c[501][501],r[501]; bool pan[501]; int dfs(int from,int to,int...原创 2018-06-18 21:14:08 · 169 阅读 · 0 评论 -
(乙)1002 写出这个数
#include <iostream> #include <iomanip> #include <cmath> #include <cstring> using namespace std; int main() { int k1,k2; while(cin>>k1) { double a[1001]= {-1}; f...原创 2018-06-18 21:13:21 · 149 阅读 · 0 评论 -
(乙)1016 部分A+B
#include <iostream> #include <iomanip> using namespace std; int main() { long long a,a1,b,b1; cin>>a>>a1>>b>>b1; int sum1=0,sum2=0; while(a) { int t=a%10; ...原创 2018-06-18 21:19:43 · 142 阅读 · 0 评论 -
(乙)1017 A除以B
本题要求计算A/B,其中A是不超过1000位的正整数,B是1位正整数。你需要输出商数Q和余数R,使得A = B * Q + R成立。 输入格式: 输入在1行中依次给出A和B,中间以1空格分隔。 输出格式: 在1行中依次输出Q和R,中间以1空格分隔。 输入样例: 123456789050987654321 7 输出样例: 17636684150141093474 3原创 2018-06-19 12:19:23 · 142 阅读 · 0 评论 -
(乙)1030 完美数列
#include <iostream> #include <algorithm> #include <cstring> using namespace std; int main() { long long n,p; int a[100001],maxx=0; cin>>n>>p; for(int i=0;i<n;i++) ...原创 2018-06-22 22:17:47 · 152 阅读 · 0 评论 -
(乙)1027 打印沙漏
#include <iostream> #include <cstring> #include <cmath> using namespace std; int main() { int n; char a,b[1001][1001]={' '}; cin>>n; getchar(); cin>>a; int t=sqrt((...原创 2018-06-22 22:17:53 · 117 阅读 · 0 评论 -
(乙)1024 科学计数法
#include <iostream> #include <cstring> using namespace std; int main() { char a[1000]; cin>>a; int flag,flag1; for(int i=1; i<strlen(a); i++) { if(a[i]=='E') flag=i; } ...原创 2018-06-22 22:18:03 · 177 阅读 · 0 评论 -
(乙)1023 组个最小数
#include <iostream> using namespace std; int main() { int a[10]; for(int i=0;i<10;i++) { cin>>a[i]; } for(int i=1;i<=9;i++) { if(a[i]) { cout<<i; a[i]--; ...原创 2018-06-22 22:18:09 · 149 阅读 · 0 评论 -
(乙)1022 D进制的A+B
#include <iostream> using namespace std; int main() { unsigned long long a,b,c; int d; cin>>a>>b>>d; c=a+b; if(c==0) cout<<"0"; int m[100]; int x=0; while(c) { ...原创 2018-06-22 22:18:16 · 151 阅读 · 0 评论 -
(乙)1021 个位数统计
#include <iostream> #include <cstring> using namespace std; int main() { char a[1001]; cin>>a; int b[1002]={0}; for(int i=0;i<strlen(a);i++) { int t=a[i]-'0'; b[t]++; } ...原创 2018-06-21 19:22:20 · 133 阅读 · 0 评论 -
(乙)1020 月饼
#include <iostream> #include <algorithm> #include <iomanip> #include <cstring> using namespace std; int main() { int n,d; cin>>n>>d; double a[1001],b[1001],c[100...原创 2018-06-21 19:21:13 · 90 阅读 · 0 评论 -
(乙)1019 数字黑洞
#include <iostream> #include <cstring> #include <algorithm> using namespace std; int main() { int n,t1=0,t2=0,x=0; cin>>n; while(n!=6174||x==0) { x++; t1=0,t2=0; ...原创 2018-06-20 12:54:42 · 163 阅读 · 0 评论 -
(乙)1001 害死人不偿命的(3n+1)猜想
#include <iostream> #include <cmath> #include <cstring> using namespace std; int main() { int a,b,c,m[10]= {0},x=0; cin>>a>>b; c=a+b; int ok=0; if(c>=0) ok=1; el...原创 2018-06-18 21:11:58 · 178 阅读 · 0 评论