随笔分类 - PAT
摘要:Given three integers A, B and C in [−], you are supposed to tell whether A+B>C. Input Specification: The first line of the input gives the positive nu
        阅读全文
                
摘要:The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of e
        阅读全文
                
摘要:Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "ins
        阅读全文
                
摘要:注意:工作量比较大,容易逻辑失误
        阅读全文
                
摘要:给定一系列正整数,请按要求对数字进行分类,并输出以下 5 个数字: A1 = 能被 5 整除的数字中所有偶数的和; A2 = 将被 5 除后余 1 的数字按给出顺序进行交错求和,即计算 n1−n2+n3−n4⋯; A3 = 被 5 除后余 2 的数字的个数;
        阅读全文
                
摘要:#include #define Posi 10000//消除初始绝对负数,进行运算强制取正 using namespace std; int main() { int a,b; cin>>a>>b; int arr[a]; for(int i=0;i>arr[i]; } for(int i=0;i<a-1;i++){ cout...
        阅读全文
                
摘要:划拳是古老中国酒文化的一个有趣的组成部分。酒桌上两人划拳的方法为:每人口中喊出一个数字,同时用手比划出一个数字。如果谁比划出的数字正好等于两人喊出的数字之和,谁就赢了,输家罚一杯酒。两人同赢或两人同输则继续下一轮,直到唯一的赢家出现。 划拳是古老中国酒文化的一个有趣的组成部分。酒桌上两人划拳的方法为
        阅读全文
                
摘要:要获得一个 C 语言程序的运行时间,常用的方法是调用头文件 time.h,其中提供了 clock() 函数,可以捕捉从程序开始运行到 clock() 被调用时所耗费的时间。这个时间单位是 clock tick,即“时钟打点”。同时还有一个常数 CLK_TCK,给出了机器时钟每秒所走的时钟打点数。于是
        阅读全文
                
摘要:#include using namespace std; int main(){ string a,b; int Da,Db,sumA=0,sumB=0; cin>>a>>Da>>b>>Db; for(int i=0;i<a.length();i++){ if(a[i]==(Da+'0')) sumA=sumA*10+Da; } ...
        阅读全文
                
摘要:给定区间 [−] 内的 3 个整数 A、B 和 C,请判断 A+B 是否大于 C。 输入格式: 输入第 1 行给出正整数 T (≤),是测试用例的个数。随后给出 T 组测试用例,每组占一行,顺序给出 A、B 和 C。整数间以空格分隔。 输出格式: 对每组测试用例,在一行中输出 Case #X: tr
        阅读全文
                
摘要:卡拉兹(Callatz)猜想: 对任何一个正整数 n,如果它是偶数,那么把它砍掉一半;如果它是奇数,那么把 ( 3n+1)砍掉一半。这样一直反复砍下去,最后一定在某一步得到 n=1。卡拉兹在 1950 年的世界数学家大会上公布了这个猜想,传说当时耶鲁大学师生齐动员,拼命想证明这个貌似很傻很天真的命题
        阅读全文
                

 浙公网安备 33010602011771号
浙公网安备 33010602011771号