码迷,mamicode.com
首页 >  
搜索关键字:PAT    ( 13517个结果
PAT 1012 数字分类 C语言
给定一系列正整数,请按要求对数字进行分类,并输出以下5个数字:A1 = 能被5整除的数字中所有偶数的和;A2 = 将被5除后余1的数字按给出顺序进行交错求和,即计算n1-n2+n3-n4...;A3 = 被5除后余2的数字的个数;A4 = 被5除后余3的数字的平均数,精确到小数点后1位;A5 = 被...
分类:编程语言   时间:2014-05-16 22:51:33    阅读次数:315
PAT 1007 素数对猜想 C语言
让我们定义 dn为:dn= pn+1- pn,其中 pi是第i个素数。显然有 d1=1 且对于n>1有 dn是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。现给定任意正整数N ( 2 #include 3 #include 4 #define MAXN 100000 5 int a.....
分类:编程语言   时间:2014-05-16 05:07:52    阅读次数:283
Divide Two Integers
Divide two integers without using multiplication, division and mod operator. public class Solution { public int divide(int dividend, int divisor) { int sign = 1; if (dividend < 0) { ...
分类:其他好文   时间:2014-05-15 14:40:50    阅读次数:285
Pat(Advanced Level)Practice--1043(Is It a Binary Search Tree)
Pat1043代码 题目描述: A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys less than t...
分类:其他好文   时间:2014-05-15 05:09:59    阅读次数:351
Pat(Advanced Level)Practice--1043(Is It a Binary Search Tree)
Pat1043代码题目描述:A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contain...
分类:其他好文   时间:2014-05-14 22:03:25    阅读次数:487
1018. 锤子剪刀布 (20)
大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示: 现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。 输入格式: 输入第1行给出正整数N(5),即双方交锋的次数。随后N行,每行给出一次交锋的信息,即甲、乙双方同时给出的的手势。C代表“锤子”、J代表“剪刀”、B代表“布”,第1个字母代表甲方,第2个代表乙方,中间...
分类:移动开发   时间:2014-05-14 14:57:40    阅读次数:368
1023. 组个最小数 (20)
给定数字0-9各若干个。你可以以任意顺序排列这些数字,但必须全部使用。目标是使得最后得到的数尽可能小(注意0不能做首位)。例如:给定两个0,两个1,三个5,一个8,我们得到的最小的数就是10015558。 现给定数字,请编写程序输出能够组成的最小的数。 输入格式: 每个输入包含1个测试用例。每个测试用例在一行中给出10个非负整数,顺序表示我们拥有数字0、数字1、……数字9的个数。整数间用一个...
分类:其他好文   时间:2014-05-13 23:40:29    阅读次数:332
Pat(Advanced Level)Practice--1018(Public Bike Management)
Pat1018代码 题目描述: 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 an...
分类:其他好文   时间:2014-05-13 23:27:04    阅读次数:582
Pat(Advanced Level)Practice--1044(Shopping in Mars)
Pat1044代码 题目描述: Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the chain can...
分类:其他好文   时间:2014-05-13 14:33:08    阅读次数:437
Pat(Advanced Level)Practice--1016(Phone Bills)
Pat1016代码 题目描述: A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, depending on the time of day w...
分类:其他好文   时间:2014-05-13 06:45:05    阅读次数:460
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!