
PAT
水木行者
分享 交流 学习 共赢
展开
-
PAT 1005. 继续(3n+1)猜想
#include int main() {int num[101];int i, k, n, length; for(i = 0; i num[i] = -1;}scanf("%d", &k);for(i = 0; i scanf("%d", &n);num[n] = 0;}for(i = 0; i if(num[i] != 0) {原创 2015-03-03 10:26:26 · 4201 阅读 · 3 评论 -
PAT A1031. Hello World for U
1031. Hello World for U (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven any string of N (>=5) characters,原创 2015-03-07 21:20:32 · 338 阅读 · 0 评论 -
PAT A1002. A+B for Polynomials
1002. A+B for Polynomials (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time, you are supposed to find A+原创 2015-03-08 10:26:46 · 407 阅读 · 0 评论 -
PAT A 1006. Sign In and Sign Out (25)
1006. Sign In and Sign Out (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueAt the beginning of every day, the fi原创 2015-03-08 15:37:56 · 381 阅读 · 0 评论 -
PAT A1023. Have Fun with Numbers
1023. Have Fun with Numbers (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueNotice that the number 123456789 is原创 2015-03-07 15:10:13 · 376 阅读 · 0 评论 -
PAT A 1027. Colors in Mars
1027. Colors in Mars (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YuePeople in Mars represent the colors in thei原创 2015-03-07 20:35:48 · 354 阅读 · 0 评论 -
PAT A 1005. Spell It Right
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case.原创 2015-03-06 23:45:28 · 315 阅读 · 0 评论 -
PAT 1024. 科学计数法
1024. 科学计数法 (20)时间限制100 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者HOU, Qiming科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+-][1-9]"."[原创 2015-03-06 22:33:43 · 1452 阅读 · 1 评论 -
PAT A1011. World Cup Betting
1011. World Cup Betting (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueWith the 2010 FIFA World Cup running, fo原创 2015-03-07 10:55:48 · 334 阅读 · 0 评论 -
PAT A1015. Reversible Primes
1015. Reversible Primes (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA reversible prime in any number system原创 2015-03-07 13:33:53 · 352 阅读 · 0 评论 -
PAT A1019. General Palindromic Number
1019. General Palindromic Number (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA number that will be the same原创 2015-03-07 14:27:03 · 266 阅读 · 0 评论 -
PAT A1007Maximum Subsequence Sum(贪心算法)
#include int main() {int num[10000];int path[10000][3];int K, i, temp, start, end, max, max_start, max_end;scanf("%d", &K);for(i = 0; i scanf("%d", &num[i]);}for(i = 0; i if(i原创 2015-03-08 20:49:00 · 409 阅读 · 0 评论 -
PAT A1008. Elevator
1008. Elevator (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe highest building in our city has only one ele原创 2015-03-07 10:18:20 · 410 阅读 · 0 评论 -
PAT A1015. Reversible Primes
1015. Reversible Primes (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA reversible prime in any number system原创 2015-03-07 13:32:53 · 409 阅读 · 0 评论 -
PAT 1023. 组个最小数
1023. 组个最小数 (20)时间限制100 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CAO, Peng给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意原创 2015-03-06 19:37:52 · 966 阅读 · 0 评论 -
PAT A1015. Reversible Primes (20)
1015. Reversible Primes (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA reversible prime in any number system原创 2015-03-07 14:28:28 · 274 阅读 · 0 评论 -
PAT A1010 Radix (有点问题)
1010. Radix (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a pair of positive integers, for example, 6 an原创 2015-03-09 21:20:06 · 454 阅读 · 0 评论 -
PAT 1019. 数字黑洞
#include void sortNum(int* a, int* b, int* c, int* d); int main() {原创 2015-03-06 10:05:36 · 1676 阅读 · 0 评论 -
PAT B1004 成绩排名
#include #include int strGrade(char str[]) {int length;length = strlen(str);if(str[length - 2] == ' ') {return str[length - 1] - '0';} else if(str[length -3] == ' ') {return 10 * (原创 2015-03-03 09:01:47 · 976 阅读 · 0 评论 -
PAT B1003 我要通过
#include #include int main() {char str[110];int n, length, flag, leftNum, midNum, rightNum, i, j;scanf("%d", &n);for(i = 0; i scanf("%s", str);length = strlen(str);flag = 1;leftNum原创 2015-03-03 09:05:43 · 1115 阅读 · 0 评论 -
PAT 1006. 换个格式输出整数
#include int main() {int n, a, b, c, i;scanf("%d", &n);a = n / 100;b = (n % 100) / 10;c = n % 10;if(a > 0) {for(i = 0; i printf("B");}}if(b > 0) {for(i = 0; i printf("S原创 2015-03-03 15:54:36 · 1269 阅读 · 1 评论 -
PAT 1009. 说反话
#include #include int main() {char str[90];char *p, *s;int length;gets(str);length = strlen(str);for(p = str + length - 1; p != str; p --) {if(*p == ' ') {for(s = p + 1; *s !原创 2015-03-03 19:39:21 · 1737 阅读 · 0 评论 -
PAT 1013. 数素数
#include #include int prime(int num) {int sqr, flag, i;sqr = (int) sqrt(num);flag = 1;for(i = 2; i if(num % i == 0) {flag = 0;break;}} return flag;}int main() {int M,原创 2015-03-03 23:15:11 · 619 阅读 · 0 评论 -
1007. 素数对猜想
#include #include int prime(int num) {int i, flag;flag = 1;for(i = 2; i if(num % i == 0) {flag = 0;break;}}return flag;}int main() {int i, n, num;scanf("%d", &n);fo原创 2015-03-03 16:23:53 · 437 阅读 · 0 评论 -
PAT 1017. A除以B
#include #include int main() {char A[1100], Q[1100];int B, R, i, j, length, sum;scanf("%s", A);scanf("%d", &B);length = strlen(A);sum = 0;for(i = 0, j = 0; i sum = 10 * sum + A原创 2015-03-03 22:40:13 · 2743 阅读 · 0 评论 -
PAT 1014. 福尔摩斯的约会
#include int main() {char str1[70], str2[70], str3[70], str4[70];char week[7][5] = {"MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};char *p, *q;int flag, i;scanf("%s", str1);scanf("原创 2015-03-05 20:05:55 · 1417 阅读 · 0 评论 -
PAT 1018. 锤子剪刀布
#include void printMax(int a, int b, int c) {if(a >= b && a >= c) {printf("B");} else if(b > a && b >= c) {printf("C");} else if(c > a && c > b) {printf("J");}}int main() {int原创 2015-03-05 22:17:59 · 481 阅读 · 0 评论 -
PAT 1020. 月饼
#include int main() {int N, D, i, j, max_i;float sum, remain, max;float num[4][1000];scanf("%d %d", &N, &D);for(i = 0; i for(j = 0; j scanf("%f", &num[i][j]);}}for(i = 0; i原创 2015-03-06 16:22:56 · 1516 阅读 · 0 评论 -
PAT A1015. Reversible Primes
1015. Reversible Primes (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA reversible prime in any number system原创 2015-03-07 13:25:41 · 322 阅读 · 0 评论 -
PAT A1009. Product of Polynomials
1009. Product of Polynomials (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time, you are supposed to find原创 2015-03-08 21:59:04 · 375 阅读 · 0 评论 -
PAT 1022. D进制的A+B
1022. D进制的A+B (20)时间限制100 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, Yue输入两个非负10进制整数A和B(30-1),输出A+B的D (1 输入格式:输入在一行原创 2015-03-06 17:46:49 · 1628 阅读 · 0 评论 -
PAT A1001. A+B Format
1001. A+B Format (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueCalculate a + b and output the sum in standard原创 2015-03-06 23:30:45 · 412 阅读 · 0 评论 -
PAT A1035. Password (20)
1035. Password (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueTo prepare for PAT, the judge sometimes has to ge原创 2015-03-07 22:03:27 · 337 阅读 · 0 评论 -
PAT A 1007. Maximum Subsequence Sum(贪心算法应用path[i] 与 path[i + 1)
1007. Maximum Subsequence Sum (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a sequence of K integers { N原创 2015-03-08 20:40:37 · 454 阅读 · 0 评论 -
A. Consecutive Factors
A. Consecutive Factors (20)时间限制400 ms内存限制65536 kB代码长度限制8000 B判题程序Standard作者CHEN, YueAmong all the factors of a positive intege原创 2015-03-29 20:55:33 · 723 阅读 · 0 评论