import java.io.*; /** * 分别保存三个和,然后相加 */ public class Main { public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); public static StreamTokenizer cin = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); public static PrintWriter cout = new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) throws Exception { cin.nextToken(); double a; a = cin.nval; cin.nextToken(); double b; b = cin.nval; cin.nextToken(); double c; c = cin.nval; double sum1 = 0, sum2 = 0, sum3 = 0, sum; int i; for(i = 1; i <= a; i++){ sum1 += i; } for(i = 1; i <= b; i++){ sum2 += i * i; } for(i = 1; i <= c; i++){ sum3 += 1 /(double) i; } sum = sum1 + sum2 + sum3; cout.printf("%.2f", sum); cout.flush(); } }
0.0分
0 人评分
A+B for Input-Output Practice (C++代码)浏览:878 |
A+B for Input-Output Practice (VI) (C语言代码)浏览:602 |
点我有惊喜!你懂得!浏览:1418 |
C语言考试练习题_保留字母 (C语言代码)浏览:733 |
母牛的故事 (C语言代码)浏览:782 |
永远的丰碑 (C语言代码)浏览:698 |
字符串输入输出函数 (C++代码)(都当成字符串吧hhhhhhhh)浏览:509 |
输出正反三角形 (C语言代码)浏览:859 |
C语言程序设计教程(第三版)课后习题10.3 (C语言代码)浏览:565 |
C语言程序设计教程(第三版)课后习题6.2 (C语言代码)浏览:716 |