Skip to content

Commit

Permalink
Merge pull request #5 from BaiHLiu/master
Browse files Browse the repository at this point in the history
Add sxr's Code~
  • Loading branch information
sihuan authored Dec 12, 2020
2 parents 90e93ea + 75ca184 commit de05142
Show file tree
Hide file tree
Showing 96 changed files with 3,717 additions and 0 deletions.
37 changes: 37 additions & 0 deletions sxr/1014.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
char s[20];
int l[20];
int i=0, m=0;
scanf("%s",s);
while (i<strlen(s))
{if((s[i]!= 40) && (s[i] != 41) &&(s[i] !=45))
{l[m]=s[i]-48;
m++;
}
i++;
}
if(l[0]==0)
{
printf("0086");
for(int m=1;m<strlen(s)-3;m++)
printf("%d",l[m]);
}
else {printf("0086");
for(int m=0;m<strlen(s)-3;m++)
printf("%d",l[m]);}
return 0;
}
/**************************************************************
Problem: 1014
User: 202001060915
Language: C
Result: Accepted
Time:0 ms
Memory:748 kb
****************************************************************/

30 changes: 30 additions & 0 deletions sxr/1018.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <stdio.h>
#include <stdlib.h>

int main()
{
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if(a<=b&&b<=c)
printf("%d %d %d", a, b, c);
else if(b<=a&&a<=c)
printf("%d %d %d", b, a, c);
else if(c<=b&&b<=a)
printf("%d %d %d", c, b, a);
else if(a<=c&&c<=b)
printf("%d %d %d", a, c, b);
else if(b<=c&&c<=a)
printf("%d %d %d", b, c, a);
else if(c<=a&&a<=b)
printf("%d %d %d", c, a, b);
return 0;
}
/**************************************************************
Problem: 1018
User: 202001060915
Language: C
Result: Accepted
Time:0 ms
Memory:748 kb
****************************************************************/

31 changes: 31 additions & 0 deletions sxr/1019.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <stdio.h>

int main()
{
int b,k,m,n,i=1,a=0;
int s[150];
scanf("%d %d %d",&k,&m,&n);
while(i<=k)
{
if((i%m==0&&i%n!=0)||(i%n==0&&i%m!=0))
{
s[a]=i;
a++;
}
i++;
}
for(b=0;b<a-1;b++)
printf("%d ",s[b]);
printf("%d",s[a-1]);
return 0;
}

/**************************************************************
Problem: 1019
User: 202001060915
Language: C
Result: Accepted
Time:0 ms
Memory:748 kb
****************************************************************/

28 changes: 28 additions & 0 deletions sxr/1022.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>

int main()
{
int a, b, m, i=0, sum = 0;
int s[10];
while(a != 0 || b != 0)
{
scanf("%d %d", &a, &b);
sum = a+b;
s[i]= sum;
i++;
}
for(m=0;m<i-1;m++)
printf("%d\n",s[m]);
return 0;
}

/**************************************************************
Problem: 1022
User: 202001060915
Language: C
Result: Accepted
Time:0 ms
Memory:748 kb
****************************************************************/

27 changes: 27 additions & 0 deletions sxr/1023.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <stdio.h>
#include <stdlib.h>

int main()
{
int a, b, m, i=0, sum = 0;
int s[10];
while(scanf("%d %d", &a, &b)!=EOF)
{
sum = a+b;
s[i]= sum;
i++;
}
for(m=0;m<i-1;m++)
printf("%d\n\n",s[m]);
printf("%d",s[i-1]);
return 0;
}
/**************************************************************
Problem: 1023
User: 202001060915
Language: C
Result: Accepted
Time:0 ms
Memory:748 kb
****************************************************************/

32 changes: 32 additions & 0 deletions sxr/1024.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <stdio.h>

int main()
{
int t,p,q,a,n,i=1;
scanf("%d",&n);
scanf(" %d",&q);
t=q;
p=q;
while(i<n)
{
scanf(" %d",&a);
if(p<a)
p=a;
if(t>a)
t=a;
i++;
}
printf("The maximum number is %d.\n",p);
printf("The minimum number is %d.",t);
return 0;
}

/**************************************************************
Problem: 1024
User: 202001060915
Language: C
Result: Accepted
Time:4 ms
Memory:748 kb
****************************************************************/

40 changes: 40 additions & 0 deletions sxr/1025.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include <stdio.h>
#include <stdlib.h>

int main()
{
double a;
int b;
while(scanf("%lf",&a)!=EOF)
{ b=a/10;
if(a<0||a>100)
printf("Error\n");
else
{
switch(b)
{
case 0:printf("Failing\n");break;
case 1:printf("Failing\n");break;
case 2:printf("Failing\n");break;
case 3:printf("Failing\n");break;
case 4:printf("Failing\n");break;
case 5:printf("Failing\n");break;
case 6:printf("Pass\n");break;
case 7:printf("Average\n");break;
case 8:printf("Good\n");break;
case 9:printf("Excellent\n");break;
case 10:printf("Excellent\n");break;
}
}
}
return 0;
}
/**************************************************************
Problem: 1025
User: 202001060915
Language: C
Result: Accepted
Time:0 ms
Memory:748 kb
****************************************************************/

41 changes: 41 additions & 0 deletions sxr/1027.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include <stdio.h>
#include <stdlib.h>

int main()
{
int n, m, i, j;
int a=0,k=0;
int s[110];
scanf("%d %d", &m, &n);
i = n;
while(i>=m)
{
for(j=2;j<=i;j++)
{
if(i%j==0&&i!=j)
break;
else if(i==j)
{
s[a]=j;
a++;
}
}
i--;
}
printf("=====\n");
for(k=0;k<a;k++)
{
printf("%d\n",s[k]);
}
printf("=====\n");
return 0;
}
/**************************************************************
Problem: 1027
User: 202001060915
Language: C
Result: Accepted
Time:0 ms
Memory:748 kb
****************************************************************/

45 changes: 45 additions & 0 deletions sxr/1028.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include<stdio.h>

int main()
{
char A,B;
double i,x,s;
int h,l,t;
scanf("%c->%c",&A,&B);
scanf("%d",&h);
scanf("%d",&l);
scanf("%lf",&s);
t=l;
l=(l<h?l:h);
h=(t<h?h:t);
if(A=='C'&&B=='F')
{
for(i=l;i<=h+0.01;i+=s)
{
x=i*9.0/5.0+32.0;
if(i==l)
printf(" C -> F\n");
printf("%5.1f -> %5.1f\n",i,x);
}
}
else if(A=='F'&&B=='C')
{
for(i=l;i<=h+0.01;i+=s)
{
x=(i-32.0)*5.0/9.0;
if(i==l)
printf(" F -> C\n");
printf("%5.1f -> %5.1f\n",i,x);
}
}
return 0;
}
/**************************************************************
Problem: 1028
User: 202001060915
Language: C
Result: Accepted
Time:4 ms
Memory:748 kb
****************************************************************/

45 changes: 45 additions & 0 deletions sxr/1029.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include<stdio.h>
int main()
{
int k,i,j,m=0,n=1;
scanf("%d",&k);
if(k>=13||k<1)
printf("overflow");
else
{
for(i=1; i<=k; i++)
{
for(j=1; j<=i;j++)
{
n=n*j;
/*if(n<=0)
{
flag++;
break;
}
*/
}
m=m+n;
n=1;
/*
if(m<=0)
{
flag++;
break;
}
*/
}
printf("%d",m);
}
return 0;
}

/**************************************************************
Problem: 1029
User: 202001060915
Language: C
Result: Accepted
Time:0 ms
Memory:748 kb
****************************************************************/

Loading

0 comments on commit de05142

Please sign in to comment.