1 条题解
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int main(){ string s1,s2,s3; cin>>s1>>s2>>s3; s1 = s1.substr(0,s1.length() - 1); s2 = s2.substr(0,s2.length() - 1); s3 = s3.substr(0,s3.length() - 1); cout<<fixed<<setprecision(1)<<80 * atoi(s1.c_str()) / 100.0 <<endl; cout<<fixed<<setprecision(1)<<80 * atoi(s2.c_str()) / 100.0 <<endl; cout<<fixed<<setprecision(1)<<80 * atoi(s3.c_str()) / 100.0 <<endl; cout<<fixed<<setprecision(1)<<80 * (100 - atoi(s1.c_str()) -atoi(s2.c_str()) -atoi(s3.c_str()) )/ 100.0 <<endl; }Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); String[] strs = s.split(" "); int left = 100; for(int i=0;i<strs.length;i++) { if(!strs[i].equals("")) { String num = strs[i].split("%")[0]; int number = Integer.valueOf(num); left = left -number; System.out.printf("%.1f ",number/100.0 * 80); } } System.out.printf("%.1f ",left/100.0 * 80); sc.close(); } }Python :
a,s=[input().split(),0] for i in a: print(round(int(i[:-1])/100*80,1),end=' ') s+=int(i[:-1]) print(round((100-s)/100*80,1))
- 1
信息
- ID
- 323
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者