Enumerate the meaning of the question, understand the question in 50 minutes, and pass three times in 10 minutes. Tarjan still writes and hangs up. The scene of a large-scale car rollover.
A. You have n rubles, and you need to change the rubles into dollars and euros. The number of rubles corresponding to one dollar and one euro is given.
There are several denominations of the U.S. dollar: 1 , 2, 5, 10, 20, 50, 100
There are several denominations of euros: 5, 10, 20, 50, 100, 200
You can exchange any amount of euros And the U.S. dollar, but the U.S. dollar and euro you exchanged must be able to be expressed in the above paper currency. Ask you how many rubles are at least left in your hand
The U.S. dollar can be exchanged as long as it can be exchanged, because 1 U.S. dollar can represent any number , Euros can only be exchanged for 5 Euros and 5 Euros. Just enumerate the number of sheets exchanged for US dollars.
Code:
#include
#define int long long
#define sc(a) scanf("%lld",&a)
#define scc(a,b) scanf("%lld %lld",&a,&b)
#define sccc(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define schar(a) scanf("%c",&a)
#define pr(a) printf("%lld",a)
#define fo(i,a,b) for(int i=a;i#define re(i,a,b) for(int i=a;i<=b;++i)
#define rfo(i,a,b) for(int i=a;i>b;--i)
#define rre(i,a,b) for(int i=a;i>=b;--i)
#define prn() printf("
")
#define prs() printf(" ")
#define mkp make_pair
#define pii pair
#define pub(a) push_back(a)
#define pob() pop_back()
#define puf(a) push_front(a)
#define pof() pop_front()
#define fst first
#define snd second
#define frt front()
#define bak back()
#define mem0(a) memset(a,0,sizeof(a))
#define memmx(a) memset(a,0x3f3f,sizeof(a))
#define memmn(a) memset(a,-0x3f3f,sizeof(a))
#define debug
#define db double
#define yyes cout<<"YES"<#define nno cout<<"NO"<using namespace std;
typedef vector<int> vei;
typedef vector vep;
typedef map<int,int> mpii;
typedef map<char,int> mpci;
typedef map<string,int> mpsi;
typedef deque<int> deqi;
typedef deque<char> deqc;
typedef priority_queue<int> mxpq;
typedef priority_queue<int,vector<int>, greater<int> > mnpq;
typedef priority_queue mxpqii;
typedef priority_queue,greater > mnpqii;
const int maxn=500005;
const int inf=0x3f3f3f3f3f3f3f3f;
const int MOD=100000007;
const db eps=1e-10;
int qpow(int a,int b){int tmp=a%MOD,ans=1;while(b){if(b&< span style="color: #800080;">1){ans*=tmp,ans%=MOD;}tmp*=tmp,tmp%=MOD,b>>=1;}return ans;}
int lowbit(int x){return x&-x;}
int max(int a,int b){return a>b?a :b;}
int min(int a,int b){return aa :b;}
int mmax(int a,int b,int c){return span> max(a,max(b,c));}
int mmin(int a,int b,int c){return span> min(a,min(b,c));}
void mod(int &a){a+=MOD ;a%=MOD;}
bool chk(int now){}
int half(int l,int r){while(l<=r){int m=(l+r)/2;if (chk(m))r=m-1;else l=m+1;}return l;}
int ll(int p){return p<<1;}
int rr(int p){return p<<1|1 span>;}
int mm(int l,int r){return (l+r)/2;}
int lg(int x){if(x==0) return< /span> 1;return (int)log2(x)+1;}
bool smleql(db a,db b){if(areturn true; return false;}
db len(db a,db b,db c,db d){return sqrt((ac)*(ac) +(bd)*(b-d));}
bool isp(int x){if(x==1)return< /span> false;if(x==2)return true;for(int i=2; i*i<=x;++i)if(x%i==0)return false;return true;}
int n,d,e;
int ans=inf;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n>>d>>e;
int k=0;
while(1){
if(k*d>n) break< span style="color: #000000;">;
int tmp=n;
tmp-=k*d;
int ou=tmp/e;
ou-=ou%5;
tmp-=ou*e;
ans=min(ans,tmp);
k++;
}
cout<<ans;
return 0;
}
B, b boys and g girls have dinner, a total of n people come, now there are n+1 tables, the i-th table can be used I’m a boy and ni is a girl
Ask how many tables do you need at least so that no matter how many boys and girls come here, you can sit
SB question meaning, I haven’t figured it out for a long time, both sides Just scan it and it’s over. It means that all boys and all girls come.
Code:
#include
#define int long long
#define sc(a) scanf("%lld",&a)
#define scc(a,b) scanf("%lld %lld",&a,&b)
#define sccc(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define schar(a) scanf("%c",&a)
#define pr(a) printf("%lld",a)
#define fo(i,a,b) for(int i=a;i#define re(i,a,b) for(int i=a;i<=b;++i)
#define rfo(i,a,b) for(int i=a;i>b;--i)
#define rre(i,a,b) for(int i=a;i>=b;--i)
#define prn() printf("
")
#define prs() printf(" ")
#define mkp make_pair
#define pii pair
#define pub(a) push_back(a)
#define pob() pop_back()
#define puf(a) push_front(a)
#define pof() pop_front()
#define fst first
#define snd second
#define frt front()
#define bak back()
#define mem0(a) memset(a,0,sizeof(a))
#define memmx(a) memset(a,0x3f3f,sizeof(a))
#define memmn(a) memset(a,-0x3f3f,sizeof(a))
#define debug
#define db double
#define yyes cout<<"YES"<#define nno cout<<"NO"<using namespace std;
typedef vector<int> vei;
typedef vector vep;
typedef map<int,int> mpii;
typedef map<char,int> mpci;
typedef map<string,int> mpsi;
typedef deque<int> deqi;
typedef deque<char> deqc;
typedef priority_queue<int> mxpq;
typedef priority_queue<int,vector<int>, greater<int> > mnpq;
typedef priority_queue mxpqii;
typedef priority_queue,greater > mnpqii;
const int maxn=500005;
const int inf=0x3f3f3f3f3f3f3f3f;
const int MOD=100000007;
const db eps=1e-10;
int qpow(int a,int b){int tmp=a%MOD,ans=1;while(b){if(b&< span style="color: #800080;">1){ans*=tmp,ans%=MOD;}tmp*=tmp,tmp%=MOD,b>>=1;}return ans;}
int lowbit(int x){return x&-x;}
int max(int a,int b){return a>b?a :b;}
int min(int a,int b){return aa :b;}
int mmax(int a,int b,int c){return span> max(a,max(b,c));}
int mmin(int a,int b,int c){return span> min(a,min(b,c));}
void mod(int &a){a+=MOD ;a%=MOD;}
bool chk(int now){}
int half(int l,int r){while(l<=r){int m=(l+r)/2;if (chk(m))r=m-1;else l=m+1;}return l;}
int ll(int p){return p<<1;}
int rr(int p){return p<<1|1 span>;}
int mm(int l,int r){return (l+r)/2;}
int lg(int x){if(x==0) return< /span> 1;return (int)log2(x)+1;}
bool smleql(db a,db b){if(areturn true; return false;}
db len(db a,db b,db c,db d){return sqrt((ac)*(ac) +(bd)*(b-d));}
bool isp(int x){if(x==1)return< /span> false;if(x==2)return true;for(int i=2; i*i<=x;++i)if(x%i==0)return false;return true;}
int b,g,n;
int bb[maxn],gg[maxn];
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>b>>g>>n;
re(i,0,n) bb[i]=i,gg[i]=n-i;
int x=min(n,b);
int y=n-x;
int l;
re(i,0,n) if( bb[i]==x&&gg[i]==y) {l=i;break;}
y=min(n,g);
x=n-y;
int r;
re(i,0,n) if( bb[i]==x&&gg[i]==y) {r=i;break;}
cout<1;
return 0;
}
C. Give you a bunch of parentheses sequence, and ask if you can make the programming order by exchanging a bunch of parentheses, or you don’t need to exchange them
C. p>
On the last stack, there is only one left parenthesis in the last stack, and there is a right parenthesis in the process that does not match, then YES, direct matching also outputs YES, otherwise NO
Code:
#include
#define int long long
#define sc(a) scanf("%lld",&a)
#define scc(a,b) scanf("%lld %lld",&a,&b)
#define sccc(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define schar(a) scanf("%c",&a)
#define pr(a) printf("%lld",a)
#define fo(i,a,b) for(int i=a;i#define re(i,a,b) for(int i=a;i<=b;++i)
#define rfo(i,a,b) for(int i=a;i>b;--i)
#define rre(i,a,b) for(int i=a;i>=b;--i)
#define prn() printf("
")
#define prs() printf(" ")
#define mkp make_pair
#define pii pair
#define pub(a) push_back(a)
#define pob() pop_back()
#define puf(a) push_front(a)
#define pof() pop_front()
#define fst first
#define snd second
#define frt front()
#define bak back()
#define mem0(a) memset(a,0,sizeof(a))
#define memmx(a) memset(a,0x3f3f,sizeof(a))
#define memmn(a) memset(a,-0x3f3f,sizeof(a))
#define debug
#define db double
#define yyes cout<<"YES"<#define nno cout<<"NO"<using namespace std;
typedef vector<int> vei;
typedef vector vep;
typedef map<int,int> mpii;
typedef map<char,int> mpci;
typedef map<string,int> mpsi;
typedef deque<int> deqi;
typedef deque<char> deqc;
typedef priority_queue<int> mxpq;
typedef priority_queue<int,vector<int>, greater<int> > mnpq;
typedef priority_queue mxpqii;
typedef priority_queue,greater > mnpqii;
const int maxn=500005;
const int inf=0x3f3f3f3f3f3f3f3f;
const int MOD=100000007;
const db eps=1e-10;
int qpow(int a,int b){int tmp=a%MOD,ans=1;while(b){if(b&< span style="color: #800080;">1){ans*=tmp,ans%=MOD;}tmp*=tmp,tmp%=MOD,b>>=1;}return ans;}
int lowbit(int x){return x&-x;}
int max(int a,int b){return a>b?a :b;}
int min(int a,int b){return aa :b;}
int mmax(int a,int b,int c){return span> max(a,max(b,c));}
int mmin(int a,int b,int c){return span> min(a,min(b,c));}
void mod(int &a){a+=MOD ;a%=MOD;}
bool chk(int now){}
int half(int l,int r){while(l<=r){int m=(l+r)/2;if (chk(m))r=m-1;else l=m+1;}return l;}
int ll(int p){return p<<1;}
int rr(int p){return p<<1|1 span>;}
int mm(int l,int r){return (l+r)/2;}
int lg(int x){if(x==0) return< /span> 1;return (int)log2(x)+1;}
bool smleql(db a,db b){if(areturn true;return false;}
db len(db a,db b,db c,db d){return sqrt((a-c)*(a-c)+(b-d)*(b-d));}
bool isp(int x){if(x==1)return false;if(x==2)return true;for(int i=2;i*i<=x;++i)if(x%i==0)return false;return true;}
int n;
string s;
stack<char> st;
int l=0;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n>>s;
fo(i,0,n){
if(s[i]==‘(‘){
st.push(‘(‘);
}
else{
if(st.empty()) l++;
else st.pop();
}
}
if((l==0&&st.empty())||(l==1&&st.size()==1))
cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}
D、(待补)
#include
#define int long long
#define sc(a) scanf("%lld",&a)
#define scc(a,b) scanf("%lld %lld",&a,&b)
#define sccc(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define schar(a) scanf("%c",&a)
#define pr(a) printf("%lld",a)
#define fo(i,a,b) for(int i=a;i#define re(i,a,b) for(int i=a;i<=b;++i)
#define rfo(i,a,b) for(int i=a;i>b;--i)
#define rre(i,a,b) for(int i=a;i>=b;--i)
#define prn() printf("
")
#define prs() printf(" ")
#define mkp make_pair
#define pii pair
#define pub(a) push_back(a)
#define pob() pop_back()
#define puf(a) push_front(a)
#define pof() pop_front()
#define fst first
#define snd second
#define frt front()
#define bak back()
#define mem0(a) memset(a,0,sizeof(a))
#define memmx(a) memset(a,0x3f3f,sizeof(a))
#define memmn(a) memset(a,-0x3f3f,sizeof(a))
#define debug
#define db double
#define yyes cout<<"YES"<#define nno cout<<"NO"<using namespace std;
typedef vector<int> vei;
typedef vector vep;
typedef map<int,int> mpii;
typedef map<char,int> mpci;
typedef map<string,int> mpsi;
typedef deque<int> deqi;
typedef deque<char> deqc;
typedef priority_queue<int> mxpq;
typedef priority_queue<int,vector<int>,greater<int> > mnpq;
typedef priority_queue mxpqii;
typedef priority_queue,greater > mnpqii;
const int maxn=500005;
const int inf=0x3f3f3f3f3f3f3f3f;
const int MOD=100000007;
const db eps=1e-10;
int qpow(int a,int b){int tmp=a%MOD,ans=1;while(b){if(b&1){ans*=tmp,ans%=MOD;}tmp*=tmp,tmp%=MOD,b>>=1;}return ans;}
int lowbit(int x){return x&-x;}
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return aa:b;}
int mmax(int a,int b,int c){return max(a,max(b,c));}
int mmin(int a,int b,int c){return min(a,min(b,c));}
void mod(int &a){a+=MOD;a%=MOD;}
bool chk(int now){}
int half(int l,int r){while(l<=r){int m=(l+r)/2;if(chk(m))r=m-1;else l=m+1;}return l;}
int ll(int p){return p<<1;}
int rr(int p){return p<<1|1;}
int mm(int l,int r){return (l+r)/2;}
int lg(int x){if(x==0) return 1;return (int)log2(x)+1;}
bool smleql(db a,db b){if(areturn true;return false;}
db len(db a,db b,db c,db d){return sqrt((a-c)*(a-c)+(b-d)*(b-d));}
bool isp(int x){if(x==1)return false;if(x==2)return true;for(int i=2;i*i<=x;++i)if(x%i==0)return false;return true;}
int n,d,e;
int ans=inf;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n>>d>>e;
int k=0;
while(1){
if(k*d>n) break;
int tmp=n;
tmp-=k*d;
int ou=tmp/e;
ou-=ou%5;
tmp-=ou*e;
ans=min(ans,tmp);
k++;
}
cout<<ans;
return 0;
}
#include
#define int long long
#define sc(a) scanf("%lld",&a)
#define scc(a,b) scanf("%lld %lld",&a,&b)
#define sccc(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define schar(a) scanf("%c",&a)
#define pr(a) printf("%lld",a)
#define fo(i,a,b) for(int i=a;i#define re(i,a,b) for(int i=a;i<=b;++i)
#define rfo(i,a,b) for(int i=a;i>b;--i)
#define rre(i,a,b) for(int i=a;i>=b;--i)
#define prn() printf("
")
#define prs() printf(" ")
#define mkp make_pair
#define pii pair
#define pub(a) push_back(a)
#define pob() pop_back()
#define puf(a) push_front(a)
#define pof() pop_front()
#define fst first
#define snd second
#define frt front()
#define bak back()
#define mem0(a) memset(a,0,sizeof(a))
#define memmx(a) memset(a,0x3f3f,sizeof(a))
#define memmn(a) memset(a,-0x3f3f,sizeof(a))
#define debug
#define db double
#define yyes cout<<"YES"<#define nno cout<<"NO"<using namespace std;
typedef vector<int> vei;
typedef vector vep;
typedef map<int,int> mpii;
typedef map<char,int> mpci;
typedef map<string,int> mpsi;
typedef deque<int> deqi;
typedef deque<char> deqc;
typedef priority_queue<int> mxpq;
typedef priority_queue<int,vector<int>,greater<int> > mnpq;
typedef priority_queue mxpqii;
typedef priority_queue,greater > mnpqii;
const int maxn=500005;
const int inf=0x3f3f3f3f3f3f3f3f;
const int MOD=100000007;
const db eps=1e-10;
int qpow(int a,int b){int tmp=a%MOD,ans=1;while(b){if(b&1){ans*=tmp,ans%=MOD;}tmp*=tmp,tmp%=MOD,b>>=1;}return ans;}
int lowbit(int x){return x&-x;}
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return aa:b;}
int mmax(int a,int b,int c){return max(a,max(b,c));}
int mmin(int a,int b,int c){return min(a,min(b,c));}
void mod(int &a){a+=MOD;a%=MOD;}
bool chk(int now){}
int half(int l,int r){while(l<=r){int m=(l+r)/2;if(chk(m))r=m-1;else l=m+1;}return l;}
int ll(int p){return p<<1;}
int rr(int p){return p<<1|1;}
int mm(int l,int r){return (l+r)/2;}
int lg(int x){if(x==0) return 1;return (int)log2(x)+1;}
bool smleql(db a,db b){if(areturn true;return false;}
db len(db a,db b,db c,db d){return sqrt((a-c)*(a-c)+(b-d)*(b-d));}
bool isp(int x){if(x==1)return false;if(x==2)return true;for(int i=2;i*i<=x;++i)if(x%i==0)return false;return true;}
int b,g,n;
int bb[maxn],gg[maxn];
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>b>>g>>n;
re(i,0,n) bb[i]=i,gg[i]=n-i;
int x=min(n,b);
int y=n-x;
int l;
re(i,0,n) if(bb[i]==x&&gg[i]==y) {l=i;break;}
y=min(n,g);
x=n-y;
int r;
re(i,0,n) if(bb[i]==x&&gg[i]==y) {r=i;break;}
cout<1;
return 0;
}
#include
#define int long long
#define sc(a) scanf("%lld",&a)
#define scc(a,b) scanf("%lld %lld",&a,&b)
#define sccc(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define schar(a) scanf("%c",&a)
#define pr(a) printf("%lld",a)
#define fo(i,a,b) for(int i=a;i#define re(i,a,b) for(int i=a;i<=b;++i)
#define rfo(i,a,b) for(int i=a;i>b;--i)
#define rre(i,a,b) for(int i=a;i>=b;--i)
#define prn() printf("
")
#define prs() printf(" ")
#define mkp make_pair
#define pii pair
#define pub(a) push_back(a)
#define pob() pop_back()
#define puf(a) push_front(a)
#define pof() pop_front()
#define fst first
#define snd second
#define frt front()
#define bak back()
#define mem0(a) memset(a,0,sizeof(a))
#define memmx(a) memset(a,0x3f3f,sizeof(a))
#define memmn(a) memset(a,-0x3f3f,sizeof(a))
#define debug
#define db double
#define yyes cout<<"YES"<#define nno cout<<"NO"<using namespace std;
typedef vector<int> vei;
typedef vector vep;
typedef map<int,int> mpii;
typedef map<char,int> mpci;
typedef map<string,int> mpsi;
typedef deque<int> deqi;
typedef deque<char> deqc;
typedef priority_queue<int> mxpq;
typedef priority_queue<int,vector<int>,greater<int> > mnpq;
typedef priority_queue mxpqii;
typedef priority_queue,greater > mnpqii;
const int maxn=500005;
const int inf=0x3f3f3f3f3f3f3f3f;
const int MOD=100000007;
const db eps=1e-10;
int qpow(int a,int b){int tmp=a%MOD,ans=1;while(b){if(b&1){ans*=tmp,ans%=MOD;}tmp*=tmp,tmp%=MOD,b>>=1;}return ans;}
int lowbit(int x){return x&-x;}
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return aa:b;}
int mmax(int a,int b,int c){return max(a,max(b,c));}
int mmin(int a,int b,int c){return min(a,min(b,c));}
void mod(int &a){a+=MOD;a%=MOD;}
bool chk(int now){}
int half(int l,int r){while(l<=r){int m=(l+r)/2;if(chk(m))r=m-1;else l=m+1;}return l;}
int ll(int p){return p<<1;}
int rr(int p){return p<<1|1;}
int mm(int l,int r){return (l+r)/2;}
int lg(int x){if(x==0) return 1;return (int)log2(x)+1;}
bool smleql(db a,db b){if(areturn true;return false;}
db len(db a,db b,db c,db d){return sqrt((a-c)*(a-c)+(b-d)*(b-d));}
bool isp(int x){if(x==1)return false;if(x==2)return true;for(int i=2;i*i<=x;++i)if(x%i==0)return false;return true;}
int n;
string s;
stack<char> st;
int l=0;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n>>s;
fo(i,0,n){
if(s[i]==‘(‘){
st.push(‘(‘);
}
else{
if(st.empty()) l++;
else st.pop();
}
}
if((l==0&&st.empty())||(l==1&&st.size()==1))
cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}