1.3 Arithmetic expressions and sequential execution of programming basics

Source: Internet
Author: User

Brush water problem, brush water problem

portal:http://noi.openjudge.cn/ch0103/

A+b

*c (A+B)

(a+b)/C

04 with remainder Division

05 floating-point values for the calculation of fractions

It's all about seeing the test instructions can read.

#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {    int A, b;    CIN>>a>>b;    cout<<a+b;     return 0 ;}
View Code
#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {int  a,b,c;cin>>a>>b>>c;cout<< (a+b) *C;     return0;}
View Code
#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {int  a,b,c;cin>>a>>b>>c;cout<< (a+b)/C;     return0;}
View Code
#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {int  a,b;cin>>a>>b;cout<<a/b<<' '<<a%b;     return 0 ;}
View Code
#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {double  a,b;cin>>a>>b;printf ("%.9lf ", A/b)    ; return 0 ;}
View Code

http://noi.openjudge.cn/ch0103/06/

Unexpected gain: output% can be used with printf ("percent"); 233 then the output "can use printf (" ""); 233

07 Calculating the value of a polynomial

#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {double  a,b,c,d,x;cin>>x>>a>>b>>c>>d;printf (  "%.7lf", a*x*x*x+b*x*x+c*x+D);     return 0 ;}
View Code

Actually, just use the POW better?

How about a few days to get a quick polynomial division trial?

08-20

Water problem, a little bit of pit

Direct Sticker Code

#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {double  f;cin>>f;printf ("%.5lf" ,5* (f-a)/9)    ; return 0 ;}
View Code
 #include <iostream> #include  <cstring>  #include  <cstdio>using  namespace   Std;  int   Main () { double   R;cin  >>r;printf (  " %.4lf%.4lf%.4lf  " , R*2 , R*2  *3.14159 , R*r*3.14159  );  return  0  ;}  
View Code
#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {float  r1,r2;cin>>r1>>r2;printf ("%.2LF  ",1/(1/r1+1/R2));     return 0 ;}
View Code
#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {double  a,b;cin>>a>>b; int c;c=a/b;printf ("%g", a-b*c);     return 0 ;}
View Code
#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {double  r;cin>>r;printf ("%.2lf" ,3.14*r*r*r*4/3);     return 0 ;}
View Code
#include <iostream>#include<cstring>#include<cstdio>using  namespace  std; int Main () {int  n;cin>>n;cout<<n%<< (n/10 )%<<n/; return 0 ;}
View Code
#include <iostream>#include<cstdio>usingnamespace  std; int Main () {    int  v,h,r;    CIN>>h>>R;    V=h*r*r*3.14;    cout<<20000/v+1;     return 0 ;}
View Code
#include <iostream>#include<cstdio>#include<cmath>using  namespace  std; int Main () {    double  xa,ya,xb,yb;    CIN>>xa>>xb>>ya>>YB;    printf ("%.3lf", sqrt ((Xa-ya) * (Xa-ya) + (XB-YB) * (xb-YB));     return 0 ;}
View Code
#include <iostream>#include<cstdio>#include<cmath>using namespacestd;intMain () {DoubleA,b,c,r; CIN>>a>>b>>C; if(a+b>c) && (c+b>a) && (a+c>b)) {R= (a+b+c)/2; printf ("%.4LF", sqrt (r* (r-a) * (r-b) * (rc)); }    Elsecout<<"Data Error"; return 0;}
View Code
#include <iostream>#include<cstdio>#include<cmath>using namespacestd;intMain () {DoubleX1,x2,x3,y1,y2,y3,a,b,c,r; CIN>>x1>>y1>>x2>>y2>>x3>>Y3; A=sqrt ((x1-x2) * (X1-X2) + (y1-y2) * (y1-y2)); b=sqrt ((x2-x3) * (X2-X3) + (y2-y3) * (y2-y3)); C=sqrt ((x1-x3) * (X1-X3) + (y1-y3) * (y1-y3)); R= (a+b+c)/2; printf ("%.2LF", sqrt (r* (r-a) * (r-b) * (rc)); return 0;}
View Code
#include <iostream>#include<cstdio>#include<cmath>using  namespace  std; int Main () {    int  a1,a2,n;    CIN>>a1>>a2>>N;    cout<<a1+ (A2-A1) * (n1);     return 0 ;}
View Code
#include <iostream>#include<cstdio>#include<cmath>using  namespace  std; int Main () {longlong  a,b;cin>>a>>b;cout<<a*b;     return0;}
View Code
#include <iostream>#include<cstdio>#include<cmath>using namespacestd;#definefor (i,j,k) for (int i=j;i<=k;i++)intMain () {Long Longa,b;cin>>a;b=1; For (I,1, a) b=b*2; cout<<b; return 0;}
View Code

Unexpected harvest: Helen formula

1.3 Arithmetic expressions and sequential execution of programming basics

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.