mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 100819M.cpp
This commit is contained in:
parent
9e31c50122
commit
f386cf069c
72
Codeforces/Gym/100819M.cpp
Normal file
72
Codeforces/Gym/100819M.cpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
string op;
|
||||||
|
int parm;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
int operation_type[16];
|
||||||
|
int operation_parm[16];
|
||||||
|
|
||||||
|
bool takeoperation(int a)
|
||||||
|
{
|
||||||
|
for(int i=0;i<n;i++)
|
||||||
|
{
|
||||||
|
switch(operation_type[i])
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
a+=operation_parm[i];
|
||||||
|
if(a<0) return false;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
a-=operation_parm[i];
|
||||||
|
if(a<0) return false;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
a*=operation_parm[i];
|
||||||
|
if(a<0) return false;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if(a%operation_parm[i]!=0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
a/=operation_parm[i];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
cin>>n;
|
||||||
|
for(int i=0;i<n;i++)
|
||||||
|
{
|
||||||
|
cin>>op>>operation_parm[i];
|
||||||
|
operation_type[i]=0;
|
||||||
|
switch(op.at(0))
|
||||||
|
{
|
||||||
|
case 'D':
|
||||||
|
operation_type[i]++;
|
||||||
|
case 'M':
|
||||||
|
operation_type[i]++;
|
||||||
|
case 'S':
|
||||||
|
operation_type[i]++;
|
||||||
|
case 'A':
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int cnt=0;
|
||||||
|
for(int i=1;i<=100;i++)
|
||||||
|
{
|
||||||
|
if(takeoperation(i))
|
||||||
|
{
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cout<<100-cnt<<endl;
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user