close
題目概要:
計算出農夫可以得多少獎金。
解題方向:
農地面積呈上農夫的環保等級即是答案。
程式碼:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Java | |
import java.util.Scanner; | |
class uva10300{ | |
public static void main(String args[]){ | |
Scanner sc=new Scanner(System.in); | |
int cases=sc.nextInt(); | |
for(int i=0;i<cases;i++){ | |
int n=sc.nextInt(); | |
long ans=0; | |
for(int j=0;j<n;j++){ | |
//a=農地面積 b=有多少動物在此農地 c=農夫環保級數。 | |
long a=sc.nextLong(),b=sc.nextLong(),c=sc.nextLong(); | |
ans+=a*c; | |
} | |
//Output | |
System.out.println(ans); | |
} | |
} | |
} |
文章標籤
全站熱搜