forked from arv002-zz/spojcodes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ABSYS - Anti-Blot System.cpp
59 lines (51 loc) · 1.4 KB
/
ABSYS - Anti-Blot System.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,T;
cin>>T;
while(T--)
{
string a,b,c;
char o,p;
cin>>a>>o>>b>>p>>c;
//cout<<a<<o<<b<<p<<c;
int len1=a.length();
int len2=b.length();
int len3=c.length();
if(a.find("machula") != std::string::npos)
{
int num3=0;
int num2=0,i;
for(i=0; i<len2; i++)
num2=10*num2+(b[i]-'0');
for(i=0; i<len3; i++)
num3=10*num3+(c[i]-'0');
cout<<num3-num2<<" + "<<b<<" = "<<c<<"\n";
continue;
}
if(b.find("machula") != std::string::npos)
{
int num3=0;
int num1=0,i;
for(i=0; i<len1; i++)
num1=10*num1+(a[i]-'0');
for(i=0; i<len3; i++)
num3=10*num3+(c[i]-'0');
cout<<a<<" + "<<num3-num1<<" = "<<c<<"\n";
continue;
}
if(c.find("machula") != std::string::npos)
{
int num2=0;
int num1=0,i;
for(i=0; i<len1; i++)
num1=10*num1+(a[i]-'0');
for(i=0; i<len2; i++)
num2=10*num2+(b[i]-'0');
cout<<a<<" + "<<b<<" = "<<num1+num2<<"\n";
continue;
}
}
return 0;
}