QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#604925#2510. Make Numbersucup-team3474WA 2ms7944kbC++202.0kb2024-10-02 14:36:292024-10-02 14:36:30

Judging History

你现在查看的是最新测评结果

  • [2024-10-02 14:36:30]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:7944kb
  • [2024-10-02 14:36:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1919810;
typedef long long ll;
typedef pair<ll,ll> PII;
ll n,m,k;
ll a[N],b[N];
char s[N];
int p[N];
set<int> se;



int main(){
    for(int i=1;i<=4;i++) cin>>a[i];
    for(int i=1;i<=4;i++) p[i]=i;
    do{ 
        for(int i1=1;i1<=4;i1++){
            b[2]=i1;
            for(int i2=1;i2<=4;i2++){
                b[3]=i2;
                for(int i3=1;i3<=4;i3++){
                    b[4]=i3;
                    stack<int> st,st2;
                    st.push(a[p[1]]);
                    st2.push(1);
                    int cnt1=0,cnt2=0,cnt4=0;
                    for(int j=2;j<=4;j++){
                        int t=a[p[j]];
                        
                        if(b[j]==1){
                            cnt1++;
                            st.push(t);
                            st2.push(1);
                        }else if(b[j]==2){
                            cnt2++;
                            st.push(t);
                            st2.push(-1);
                        }else if(b[j]==3){
                            t*=st.top();
                            st.pop();
                            st.push(t);
                        }else{
                            cnt4++;
                            t=st.top()*10+t;
                            st.pop();
                            st.push(t);
                        }
                    }
                    int ans=0;
                    while(st.size()){
                        ans+=st.top()*st2.top();
                        st.pop();
                        st2.pop();
                    }
                    // if(cnt4==3) continue;
                    // cout<<ans<<endl;
                    if(ans>=0)
                    se.insert(ans);
                }
            }
        }

    }while(next_permutation(p+1,p+1+4));
    // for(auto x:se) cout<<x<<" ";
    // cout<<endl; 
    cout<<se.size();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 7708kb

input:

1 1 1 1

output:

15

result:

ok single line: '15'

Test #2:

score: 0
Accepted
time: 0ms
memory: 7944kb

input:

1 1 1 1

output:

15

result:

ok single line: '15'

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 7872kb

input:

1 1 2 1

output:

35

result:

wrong answer 1st lines differ - expected: '32', found: '35'