UVA 10550 - Combination Lock

UVA Sep 1, 2020

Problem PDF

Solution:

/*-----------------------------------------------*/
//Problem Setter: G. V. Cormack
//Problem Name  : Combination Lock
//Uva Problem No: 10550
//Type          : Ad hoc.
//Author        : Shipu Ahamed
//University    : BUBT
//E-mail        : [email protected]
/*-----------------------------------------------*/
//Hints : http://www.questtosolve.com/browse.php?pid=10550
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ll long long
#define sc scanf
#define pf printf
#define pi 2*acos(0.0)
#define mod 1000000007
using namespace std;
int main()
{
    int a,b,c,s,n;
    while(cin>>n>>a>>b>>c)
    {
          if(n==0&&a==0&&b==0&&c==0) break;
           s = 0;
        if (n b)
            s+=40-(a-b);
        else
            s+=(b-a);

        if (b > c)
            s +=(b-c);
        else
            s +=40-(c-b);

        cout<< (1080 + (9*s))<
https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/10550/10550.cpp

Tags

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.