`
弄月吟风
  • 浏览: 200020 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论
文章列表
题目大意:这是一个倒水的问题,有A,B两个杯子,现要你通过往A,B杯子中倒水,然后得到题目中所需要的水量,注意:题目要求的水量最后是放在B杯子中的,还有倒水的解不唯一; #include<stdio.h> int main() { int a,b,n,temp1,temp2; while(scanf("%d%d%d",&a,&b,&n)!=EOF) { temp1=temp2=0; while(1) { if(temp1==0) { printf("fill A\n"); temp1+=a; } ...
#include<stdio.h> #include<string.h> char c[2000];//全局变量,存储大数运算的结果 char arr[1000];//高精度除以高精度的余数 long z=0;//高精度除以低精度的余数 int Judge(char ch[]) {//判断字符串ch是否全为,若全为,返回,否则返回 ...
/*求n个数的的最小公倍数,这里运用了辗转相除法*/ #include <stdio.h> int gcd(int a,int b) //最大公约数算法 { if(a%b==0) return b; else return gcd(b,a%b); } int lcm(int a,int b) //最小公倍数(两数相乘后除以最大公约数) { return a/gcd(a,b)*b; //注意先除后乘,否则会造成结果过大 } ...
#include <iostream> using namespace std; #define SWAP(i,j) {int t=(i);(i)=(j);(j)=t;} //插入排序 void InsertSort(int*a,int len) { for (int i=1;i<len;i++) { int j=i,x=a[i]; while (j && a[j-1]>x)a[j]=a[j-1],j--; a[j ...
Global site tag (gtag.js) - Google Analytics