Jiangxi University of Science and technology new basic exercises (1)

Source: Internet
Author: User

This time the topic is hdu1089-1096 ( if you do the right, please turn to the last side )

1089 whatever you want.

#include <iostream>usingnamespace  std; int Main () {    int  N, M, K;      while (Cin >> m>>N)    {        = m + N;         << k << Endl;    }     return 0 ;}

1090 as well.

#include <iostream>usingnamespace  std; int Main () {    int  n;    CIN>>N;     int b;      for (;n>0; n--)    {            cin>>a>>b;            cout<<a+b<<endl;    }     return 0 ;}

1091 Notice the end condition

#include <stdio.h>intMainintargcChar Const*argv[]) {  intb; scanf ("%d%d",&a,&b);  while(a!=0|| b!=0) {printf ("%d\n", A +b); scanf ("%d%d",&a,&b); }  return 0;}

1092 or pay attention to the end condition

 #include <iostream>using  namespace   Std;  int   Main () { int      A,b,n;     for  (;(cin>>n) &&n;) { for  (A=0 ; N>0 ; N-- >>b;            A  +=B;    } cout  <<a<<ENDL;  return  0  ;}

1093 nothing changed, just add a T-Group of data

#include <stdio.h>intMainintargcChar Const*argv[]) {  intN;  while(SCANF ("%d", &n)! =EOF) {     for(size_t i =0; I < n; i++) {      intTotal=0, B,a; scanf ("%d",&b);  for(size_t i =0; I <b; i++) {scanf ("%d",&a); Total+=A; } printf ("%d\n", total); }  }  return 0;}

1094

#include <iostream>usingnamespace  std; int Main () {    int  a,b,n;      while (cin>>N)    {        for (a=0; n>0; n--)        {            cin>>b;            A+ =b;        }        cout<<a<<endl;    }     return 0 ;}

1095 for two lines, that's right.

#include <iostream>usingnamespace  std; int Main () {    int A, b;      while (cin>>a>>B)        cout<<a+b<<endl<<Endl;     return 0 ;}

1096 Note that the last set of data is a newline, we can use a count t to now process to the first group of data, and then the last line of a line

The code that was written a long time ago

#include <stdio.h>intMainvoid){    intn,i,sum,m,temp; scanf ("%d",&N);  while(N) {scanf ("%d",&M); Sum=0;  for(i=0; i<m; i++) {scanf ("%d",&temp); Sum+=temp; }        if(n!=1) printf ("%d\n\n", sum); Elseprintf ("%d\n", sum); N--; }    return 0;}

UVA 10055 It's very easy to read test instructions.

 #include <stdio.h> #include  <iostream>  #include  <algorithm>using  namespace   Std;  int  Main (int  argc, char  const  *argv[]) { long  long   A, b;  while  (Cin>>a>>b) {cout<<abs (A-B) <<ENDL;  return  0  ;}

UVA 100,711 Physics topics, difficulty is not university physics

 #include <stdio.h> #include  <iostream>  #include  <algorithm>using  namespace   Std;  int  Main (int  argc, char  const  *argv[]) { long  long   A, b;  while  (Cin>>a>>b) {cout<<2  *a*b<<ENDL;  return  0  ;}

UVA 10300 Read Test instructions, we know only ask area * friendly and on the line

#include <stdio.h>#include<iostream>#include<algorithm>using namespacestd;intMain () {intT,n; intSquare,animal,enfriend; CIN>>T;  while(t--) {cin>>N; intsum=0;  while(n--) {cin>>square>>animal>>Enfriend; Sum+ = (square*enfriend); } cout<<sum<<Endl; }    return 0;}

Jiangxi University of Science and Technology new basic exercise (1)

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.