1 solutions
-
0
C :
#include <stdio.h> int main() { int a; float b[2]; while(scanf("%d",&a) != EOF) { if (a==1) { b[0]=0.0833; b[1]=0.05; for(int i=0;i<2;i++) printf("%.4f\n",b[i]); } else { b[0]=0.0001; printf("%.4f\n",b[0]); } } return 0; }C++ :
#include <stdio.h> int main() { int a; float b; while(scanf("%d",&a) != EOF) {if (a==1){ b=1.0/12; printf("%.4f\n",b); b=1.0/20; printf("%.4f\n",b); } else{ b=0.0001; printf("%.4f\n",b); } } return 0; }Java :
import java.text.DecimalFormat; 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.0000"); while(reader.hasNext()){ a = reader.nextInt(); if(a==1){ f = null; f =new float[2]; f[0]=(float) 1/12; f[1]=(float)1/20; } else { f = null; f =new float[1]; f[0] = (float) 0.0001; } for(int i=0;i<f.length;i++){ System.out.println(df.format(f[i])); } } } }
- 1
Information
- ID
- 16411
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By