1 条题解
-
0
C++ :
#include<bits/stdc++.h> using namespace std; long long n,k,t; int main() { cin>>n; while(n--) { long long a=0,b=0,c=0; cin>>k; if(k==1)cin>>a>>b,t+=(a+b)*2; if(k==2)cin>>a,t+=a*4; if(k==3)cin>>a>>b>>c,t+=a+b+c; } cout<<t; return 0; }
Pascal :
var k,i,n:longint;a,b,c,s:int64; begin read(n); for i:=1 to n do begin read(k); case k of 1:begin read(a); read(b); end; 2:read(a); 3:begin read(a); read(b); read(c); end; end; case k of 1:s:=s+a*2+b*2; 2:s:=s+a*4; 3:s:=s+a+b+c; end; end; write(s); end.
- 1
信息
- ID
- 2139
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者