摘要: 题解: #include<stdio.h>int main(){ int A,B,C; scanf("%d %d %d",&A,&B,&C); int a,c,b,d,e,f,z,x,y; int i,j,k; int ret=0; for(i=123;i<345;i++){ //如果进行3次循环的 阅读全文
posted @ 2020-02-02 12:00 BlueValentines 阅读(122) 评论(0) 推荐(0)
摘要: 题解: #include<stdio.h>#include<math.h>int main(){ int n; scanf("%d",&n); int a[20000]={0}; int i,j; for(i=4;i<20000;i+=2){ a[i]=1; } for(i=3;i<sqrt(200 阅读全文
posted @ 2020-02-01 11:23 BlueValentines 阅读(157) 评论(0) 推荐(0)
摘要: 题解: 此题需要先排序在进行计算 #include<stdio.h>void swap(int *a,int *b){ int t=*a; *a=*b; *b=t;} //void sort(int a[],int s,int e,int b[]){// if(s>=e){// return;//  阅读全文
posted @ 2020-01-31 13:28 BlueValentines 阅读(131) 评论(0) 推荐(0)
摘要: 题解: 错误的: #include<stdio.h>int n,ret=0,a[10000][10];int p(int c,int s){ int i; for(i=1;i<=3;i++){ s+=i; if(c==9){ if(s==n){ a[ret][c]=i; ret++; return 阅读全文
posted @ 2020-01-30 19:15 BlueValentines 阅读(109) 评论(0) 推荐(0)
摘要: 题解: 第一次: 算法复杂度过高,导致编译超时,需要优化 #include<stdio.h>#include<math.h>int a[100000001] = { 0 };int p(int n) { int t = n, ret = 0; while (t > 0) { t /= 10; ret 阅读全文
posted @ 2020-01-29 12:36 BlueValentines 阅读(120) 评论(0) 推荐(0)
摘要: 题解: #include<stdio.h>int a[10]={6,2,5,5,4,5,6,3,7,6};int num(int n){ //计算所需火柴棒的个数 int sum=0; sum+=a[n%10]; //小心特殊情况——0 while(n>9){ n/=10; sum+=a[n%10] 阅读全文
posted @ 2020-01-28 10:32 BlueValentines 阅读(116) 评论(0) 推荐(0)
摘要: #include<stdio.h>#include<math.h>int x[20],n,k,i; //判断是否质数 int isprime(int n){ for(i=2;i<=sqrt(n);i++){ if(n%i==0)return 0; } return 1;} ************* 阅读全文
posted @ 2020-01-27 18:26 BlueValentines 阅读(157) 评论(0) 推荐(0)
摘要: 有12枚硬币。其中有11枚真币和1枚假币。假币和真币重量不同,但不知道假币比真币轻还是重。现在,用一架天平称了这些币三次,告诉你称的结果,请你.找出假币并且确定假币是轻是重(数据保证一定能找出来)。 输入样例1(1组测试数据,每组测试数据有三行)ABCD EFGH even(even平,up右边高, 阅读全文
posted @ 2020-01-26 19:43 BlueValentines 阅读(227) 评论(0) 推荐(0)
摘要: 人有体力、情商、智商的高峰日子,它们分别每隔23天、28天和33天出现一次。对于每个人,我们想.知道何时三个高峰落在同一天。给定三个高峰出现的日子p,e和i (不一定是第一次高峰出现的日子) ,再给定另一个指定的日子d,你的任务是输出日子d之后,下一次三个高峰落在同一天的日子(用距离d 的天数表示) 阅读全文
posted @ 2020-01-24 10:26 BlueValentines 阅读(203) 评论(0) 推荐(0)
摘要: 完美立方等式:a^3=b^3+c^3+d^3,例如:12^3=6^3+8^3+10^3。 对任意给的正整数N(N<=100),寻找所有组(a,b,c,d),使得构成完美立方等式,其中a,b,c,d大于1,小于N,且b<=c<=d。 输入 一个正整数N(N<=100) 输出 所有符合的组合 每行输出一 阅读全文
posted @ 2020-01-23 17:40 BlueValentines 阅读(326) 评论(0) 推荐(0)