Submission #1872219


Source Code Expand

/*
	##############################
	## Author: Pratyush Gaurav ###
	## College: NIT ROURKELA #####
	##############################
*/
#include <bits/stdc++.h>

using namespace std;

typedef long long/*--------------------*/lli;
typedef long double/*------------------*/ld;
typedef unsigned long long/*-----------*/ulli;
typedef pair<lli, lli >/*--------------*/plli;
typedef vector<plli >/*----------------*/vplli;

#define rep(i,a)/*---------------------*/for(i = 0 ; i < a ; i++)
#define repr(i,a)/*--------------------*/for(i = a ; i >= 0 ; i--)
#define REP(i,a,b)/*-------------------*/for(i = a ; i <= b ; i++)
#define REPR(i,a,b)/*------------------*/for(i = a ; i >= b ; i--)

#define scan(N)/*----------------------*/scanf("%lld",&N)
#define print(N)/*---------------------*/printf("%lld",N)
#define scan2(N1,N2)/*-----------------*/scanf("%lld %lld",&N1,&N2)
#define print2(N1,N2)/*----------------*/printf("%lld %lld",N1,N2)
#define scan3(N1,N2,N3)/*--------------*/scanf("%lld %lld %lld",&N1,&N2,&N3)
#define print3(N1,N2,N3)/*-------------*/printf("%lld %lld %lld",N1,N2,N3)

#define lb/*---------------------------*/lower_bound
#define ub/*---------------------------*/upper_bound
#define pb/*---------------------------*/push_back
#define popb/*-------------------------*/pop_back

#define mem(a,b)/*---------------------*/memset(a,b,sizeof(a))
#define opt/*--------------------------*/ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sz/*---------------------------*/size()

#define MP/*---------------------------*/make_pair
#define bs/*---------------------------*/binary_search
#define gcd(a, b)/*--------------------*/__gcd(a, b)
#define lcm(a, b)/*--------------------*/((a)*((b)/gcd(a,b)))
#define sqr(x)/*-----------------------*/(x)*(x)
#define all(a)/*-----------------------*/a.begin(),a.end()

#define ff/*---------------------------*/first
#define ss/*---------------------------*/second

#define endl/*-------------------------*/'\n'
#define inf/*--------------------------*/(lli)2000000000000
#define MOD/*--------------------------*/(lli)1000000007
#define MAXN/*-------------------------*/100005

template<class T> bool is_prime(T n)
{
	if((n%2 == 0 and n > 2) or n < 2 )
		return false;
	for(T i = 3; i*i <= n ; i += 2)
	{
		if( n % i == 0)
			return false;
	}
	return true;
}
lli power(lli a,lli b)
{
    lli value;
    if(!b)
    	return 1;
    else if(b%2==0)
    {
        value = power(a,b/2)%MOD;
        return (value * value)%MOD;
    }
    else
    {
        value = power(a,b/2)%MOD;
        return ((a*value)%MOD*(value))%MOD;
    }
}

lli a,b,c,d;
lli op(lli a,lli b,lli c)
{
    return c ? a-b : a+b;
}
int main()
{
	opt;
	lli i,j,k;
	scanf("%1d%1d%1d%1d",&a,&b,&c,&d);
	rep(i,2)
	{
	    rep(j,2)
	    {
	        rep(k,2)
	        {
	            //printf("%d %d %d\n",i,j,k);
	            lli ans1 = 0,ans2 = 0;
	            ans1 = op(a,b,i);
	            ans2 = op(c,d,k);
	            lli ans = op(ans1,ans2,j);
	            if(ans == 7)
                {
                    printf("%lld",a);
                    if(i == 0)
                        printf("+");
                    else if(i)
                        printf("-");
                    printf("%lld",b);
                    if(j == 0)
                        printf("+");
                    else if(j)
                        printf("-");
                    printf("%lld",c);
                    if(k == 0)
                        printf("+");
                    else if(k)
                        printf("-");
                    printf("%lld",d);
                    printf("=7");
                        //exit(0);
                }
	        }
	    }
	}
	return 0;
}








Submission Info

Submission Time
Task C - Train Ticket
User I_am_Nobody
Language C++14 (GCC 5.4.1)
Score 0
Code Size 3834 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:90:34: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘lli* {aka long long int*}’ [-Wformat=]
  scanf("%1d%1d%1d%1d",&a,&b,&c,&d);
                                  ^
./Main.cpp:90:34: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘lli* {aka long long int*}’ [-Wformat=]
./Main.cpp:90:34: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘lli* {aka long long int*}’ [-Wformat=]
./Main.cpp:90:34: warning: format ‘%d’ expects argument of type ‘int*’, but argument 5 has type ‘lli* {aka long long int*}’ [-Wformat=]
./Main.cpp:90:35: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%1d%1d%1d%1d",&a,&b,&c,&d);
                                   ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 1
WA × 2
AC × 5
WA × 14
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
01.txt AC 1 ms 256 KB
02.txt AC 1 ms 256 KB
03.txt WA 1 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 1 ms 256 KB
06.txt WA 1 ms 256 KB
07.txt WA 1 ms 256 KB
08.txt WA 1 ms 256 KB
09.txt WA 1 ms 256 KB
10.txt WA 1 ms 256 KB
11.txt WA 1 ms 256 KB
12.txt WA 1 ms 256 KB
13.txt WA 1 ms 256 KB
14.txt WA 1 ms 256 KB
15.txt WA 1 ms 256 KB
16.txt WA 1 ms 256 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt WA 1 ms 256 KB
sample_03.txt WA 1 ms 256 KB