Advertisement
rayated

Untitled

May 30th, 2021
1,144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int t;cin>>t;
  6.     for(int i=1;i<=t;i++)
  7.     {
  8.         int a[8],sum=30;
  9.         for(int j=1;j<=7;j++){cin>>a[j];}
  10.         if(a[7]==1) sum-=1;
  11.         if(a[1]==1 || a[4]==1 || a[5]==1 || a[6]==1 || a[7]==1) sum-=1;
  12.         if(a[3]==1 || a[6]==1) sum-=2;
  13.         if(a[5]==1 || a[6]==1) sum-=2;
  14.         if(a[1]==1 || a[4]==1 || a[5]==1) sum-=3;
  15.         if(a[2]==1 || a[5]==1) sum-=3;
  16.         if(a[2]==1) sum-=4;
  17.         if(a[4]==1 || a[5]==1 || a[6]==1 || a[7]==1) sum-=4;
  18.         if(a[5]==1) sum-=5;
  19.         cout<<"Case #"<<i<<": "<<sum<<endl;
  20.     }
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement