Rookie says C (b)--swust OJ Practice

Source: Internet
Author: User

Greatest common divisor and least common multiple:

PS: least common multiple = product/Greatest common divisor

http://acm.swust.edu.cn/problem/0038/

#include <stdio.h>intMain () {intM, N, I, C, t;//T is greatest common divisor, C is least common multiplescanf"%d%d", &m, &N);  for(i =1; I <= m&&i <= N; i++)    {        if(m% i = =0&& n% i = =0) {T=i; }} C= (M * N)/T; printf ("%d%d\n", T, c); return 0;}
Determine if it is an integer

http://acm.swust.edu.cn/problem/0028/

#include <stdio.h>intMain () {floatA;  while(~SCANF ("%f", &a)) {if( (int) A = =a) {printf ("yes\n"); }        Else{printf ("no\n"); }    }    return0;}
Three-digit maximum value

http://acm.swust.edu.cn/problem/0033/

#include <stdio.h>voidMain () {intA, B, C, Max; scanf ("%d%d%d", &a, &b, &c); if(A <b) Max=b; ElseMax=A; if(Max >c) Max=Max; ElseMax =C; printf ("%d\n", Max);}

Conjugation words

http://acm.swust.edu.cn/problem/0029/

#include <stdio.h>#include<string.h> voidMain () {Chara[ -],b[ -],t,p; intI,n,j,k,n; scanf ("%d",&N);  for(k=0; k<n;k++) {scanf ("%s%s", A, b); N=strlen (a);  for(j=0; j<n-1; j + +)            for(i=0;i< (n1-J); i++)               if(a[i]>a[i+1]) {T=A[i]; A[i]=a[i+1]; A[i+1]=T; }                for(j=0; j<n-1; j + +)                    for(i=0;i< (n1-J); i++)                       if(b[i]>b[i+1]) {p=B[i]; B[i]=b[i+1]; B[i+1]=p; }                       if(strcmp (A, b) = =0) printf ("yes\n"); Elseprintf ("no\n"); } }  

Grade of Grade

http://acm.swust.edu.cn/problem/0035/

#include <stdio.h>intMain () {intA; scanf ("%d",&a); if( -<=a && a<= -) printf ("a\n"); if( the<=a && a<= the) printf ("b\n"); if( -<=a && a<= -) printf ("c\n"); if( -<=a && a<= the) printf ("d\n"); if(a<= -) printf ("e\n"); return0;}
Number of reverse order

http://acm.swust.edu.cn/problem/0036/

#include <stdio.h>#include<string.h>voidMain () {intn=0, I; Chara[Ten]; scanf ("%s", a); N=strlen (a); printf ("%d\n", N);  for(i=0; i<n-1; i++) printf ("%c", A[i]); printf ("%c\n", A[i]);  for(i=n-1; i>=0; i--) printf ("%c", A[i]); printf ("\ n");}

Rookie says C (b)--swust OJ Practice

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.