diff --git a/QUSTOJ/1715.c b/QUSTOJ/1715.c new file mode 100644 index 0000000..b879daa --- /dev/null +++ b/QUSTOJ/1715.c @@ -0,0 +1,37 @@ +#include +#include +#include +/// itoa implement +char* int2str(int num,char* buff,int bina) +{ + char k[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; + if(bina==10) + { + sprintf(buff,"%d",num); + return buff; + } + int cnt=0; + while(num>0) + { + buff[cnt]=k[num%bina]; + num=num/bina; + cnt++; + } + buff[cnt]=0; + for(int i=0;i +#include +#include + +int cmp(const void* a,const void* b) +{ + return *((int*)b)-*((int*)a); +} + +int p[1024]; + +int main() +{ + int n,target; + scanf("%d%d",&target,&n); + for(int i=0;i +#include +#include +#define MAXN 256 +int bucket[MAXN]; + +int main() +{ + int t; + scanf("%d",&t); + int tmp; + for(int i=0;i +#include +#include + +int dx[32][32]; + +#define MAXN 20 + +void calc() +{ + dx[1][1]=1; + for(int i=2;i<=MAXN;i++) + { + for(int j=1;j<=i;j++) + { + dx[i][j]=dx[i-1][j-1]+dx[i-1][j]; + } + } +} + + +int main() +{ + calc(); + int n; + scanf("%d",&n); + for(int i=1;i<=n;i++) + { + for(int j=1;j<=i;j++) + { + printf("%d ",dx[i][j]); + } + printf("\n"); + } + return 0; +} diff --git a/QUSTOJ/1719_****090114.c b/QUSTOJ/1719_****090114.c new file mode 100644 index 0000000..298f6bb --- /dev/null +++ b/QUSTOJ/1719_****090114.c @@ -0,0 +1,19 @@ +#include + +int main() +{ + int x,i,j,k; + scanf("%d",&x); + for(i=1;i<=x;++i) + { + for(j=i;j<=x;++j) + for(k=j;k<=x;++k) + { + if(i*i+j*j==k*k) + printf("%d %d %d\n",i ,j ,k); + } + } + + return 0; +} + diff --git a/QUSTOJ/1720.c b/QUSTOJ/1720.c new file mode 100644 index 0000000..70065b3 --- /dev/null +++ b/QUSTOJ/1720.c @@ -0,0 +1,28 @@ +#include +#include +#include + +char buff[64]; + +int cnt[10]; + +int main() +{ + int n; + scanf("%d",&n); + for(int i=1;i<=n;i++) + { + sprintf(buff,"%d",i); + int len=strlen(buff); + for(int j=0;j +#include +#include +//Written by Kiritow. 求最大公约数 +long gcd(long a,long b) +{ + if(a==0||b==0) + { + if(a+b==0) + { + return 0; + } + return (a==0)?b:a; + } + + while(a!=b) + { + if(a>b) + { + a=a-b; + } + else + { + b=b-a; + } + } + return a; +} + +int main() +{ + int a,b; + scanf("%d%d",&a,&b); + int ans=gcd(a,b); + printf("%d\n%d\n",ans,a*b/ans); + return 0; +} diff --git a/QUSTOJ/1723.c b/QUSTOJ/1723.c new file mode 100644 index 0000000..abe5cf4 --- /dev/null +++ b/QUSTOJ/1723.c @@ -0,0 +1,23 @@ +#include +#include +#include +char buff[32]; +int main() +{ + int a,b; + scanf("%d,%d",&a,&b); + int tmp; + int ans=0; + for(int i=1;i<=b;i++) + { + for(int j=1;j<=i;j++) + { + buff[j-1]='0'+a; + } + buff[i]=0; + sscanf(buff,"%d",&tmp); + ans+=tmp; + } + printf("a=%d,b=%d\n%d\n",a,b,ans); + return 0; +} diff --git a/QUSTOJ/1724.c b/QUSTOJ/1724.c new file mode 100644 index 0000000..a0475bb --- /dev/null +++ b/QUSTOJ/1724.c @@ -0,0 +1,34 @@ +#include +#include +#include + +#define DUR 0.001 +double func(double x) +{ + return (2*x*x*x)-(4*x*x)+3*x-6; +} + +double dfs(double L, double Mid, double R) +{ + int t; + if(R-L < DUR) return R; + + if(func(L)*func(Mid) <=0) + { + t= dfs(L,(L+Mid)/2,Mid); + } + else if(func(Mid)*func(R) <=0) + { + t= dfs(Mid,(Mid+R)/2,R); + } + return t; +} + +int main() +{ + double a, b, c; + scanf("%lf,%lf",&a,&c); + b = (a+c)/2; + printf("x=%6.2f\n",dfs(a,b,c)); + return 0; +} diff --git a/QUSTOJ/1725.c b/QUSTOJ/1725.c new file mode 100644 index 0000000..7709416 --- /dev/null +++ b/QUSTOJ/1725.c @@ -0,0 +1,10 @@ +#include +#include +#include + +int main() +{ + printf("0\t25\t75\n4\t18\t78\n8\t11\t81\n12\t4\t84\n"); + return 0; +} + diff --git a/QUSTOJ/1725_****090114.c b/QUSTOJ/1725_****090114.c new file mode 100644 index 0000000..ffa293f --- /dev/null +++ b/QUSTOJ/1725_****090114.c @@ -0,0 +1,13 @@ +#include + +int main() +{ + + int g,m,c; + for(g=0;g<21;++g) + for(m=0;m<35;m++) + for(c=0;c<100;c+=3) + if(g*5+m*3+c/3==100&&g+m+c==100) + printf("%d\t%d\t%d\n",g,m,c); + return 0; +} diff --git a/QUSTOJ/1726.c b/QUSTOJ/1726.c new file mode 100644 index 0000000..ae2634c --- /dev/null +++ b/QUSTOJ/1726.c @@ -0,0 +1,28 @@ +#include +#include +#include + +int main() +{ + int cnt=0; + int cash; + scanf("%d",&cash); + int amax=cash/5; + int bmax=cash/2; + int cmax=cash; + for(int a=1;a<=amax;a++) + { + for(int b=1;b<=bmax;b++) + { + for(int c=1;c<=cmax;c++) + { + if(5*a+2*b+c==cash) + { + cnt++; + } + } + } + } + printf("%d\n",cnt); + return 0; +}