- #include <bits/stdc++.h>
- using namespace std;
- int a[21][3];
- int main()
- {
- int ts, cs = 1;
- cin>>ts;
- while(ts--){
- int n;
- cin>>n;
- for(int i = 0; i <n; i++){
- for(int j = 0; j <3;j++){
- cin>>a[i][j];
- }
- }
- for(int i = 1; i <n; i++){
- for(int j = 0; j <3; j++){
- a[i][j] += min(a[i-1][(j+1)%3], a[i-1][(j-1+3)%3]);
- }
- }
- printf("Case %d: %d\n", cs++,min(min(a[n-1][0], a[n-1][1]), a[n-1][2]));
- }
- return 0;
- }
Thursday, 27 July 2017
Lightoj 1047 - Neighbor House
Subscribe to:
Post Comments (Atom)
Most Featured Post
Lightoj 1159 - Batman
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
-
http://lightoj.com/volume_showproblem.php?problem=1382 Problem analysis: This is a rare problem i wrote about so far. After much strugg...
-
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
No comments:
Post a Comment