1 solutions
-
0
C :
#include <stdio.h> int main() { int a; float b[9]; while(scanf("%d",&a) != EOF) { if (a==1) { b[0]=0.625; b[1]=0.733; b[2]=0.267; b[3]=0.85; b[4]=0.15; b[5]=0.117; b[6]=0.35; b[7]=0.5; b[8]=0.375; for(int i=0;i<9;i++) printf("%.3f\n",b[i]); } else { b[0]=0.688; printf("%.3f\n",b[0]); } } return 0; }C++ :
#include<iostream> #include <iomanip> using namespace std; int main() { int a; double b; cin>>a; if (a==1) { b=0.625;cout<<fixed<<setprecision(3)<<b<<endl; b=0.733;cout<<fixed<<setprecision(3)<<b<<endl; b=0.267;cout<<fixed<<setprecision(3)<<b<<endl; b=0.850;cout<<fixed<<setprecision(3)<<b<<endl; b=0.150;cout<<fixed<<setprecision(3)<<b<<endl; b=0.117;cout<<fixed<<setprecision(3)<<b<<endl; b=0.350;cout<<fixed<<setprecision(3)<<b<<endl; b=0.500;cout<<fixed<<setprecision(3)<<b<<endl; b=0.375;cout<<fixed<<setprecision(3)<<b<<endl; } else{ b=0.688; cout<<fixed<<setprecision(3)<<b<<endl;} return 0; }Java :
import java.text.DecimalFormat; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args){ float f[] = new float[9]; Scanner reader = new Scanner(System.in); int a; DecimalFormat df=new DecimalFormat("#0.000"); while(reader.hasNext()){ a = reader.nextInt(); if(a==1){ f = null; f =new float[9]; f[0]=(float) 5/8; f[1]=(float)11/15; f[2]=(float)4/15; f[3]=(float)51/60; f[4]=(float)9/60; f[5]=(float)7/60; f[6]=(float)7/20; f[7]=(float)1/2; f[8]=(float)3/8; } else { f = null; f =new float[1]; f[0] = (float) 0.688; } for(int i=0;i<f.length;i++){ System.out.println(df.format(f[i])); } } } }
- 1
Information
- ID
- 16409
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By