求改一下

B2068 统计满足条件的 4 位数

tyt_ @ 2024-10-22 19:13:32

#include<bits/stdc++.h>
using namespace std;
    int ikun[110];
int main(){
    int n,s=0;
    cin>>n;
    for(int i=0;i<n;i++) cin>>ikun[i];
    for(int i=0;i<n;i++){
        if(ikun[i]%10/10-ikun[i]/1000-ikun[i]%1000/100-ikun[i]%100/10>0) s++;
    }
cout<<s;
}

by tyt_ @ 2024-10-22 19:15:36

个位写错了哇

#include<bits/stdc++.h>
using namespace std;
    int ikun[110];
int main(){
    int n,s=0;
    cin>>n;
    for(int i=0;i<n;i++) cin>>ikun[i];
    for(int i=0;i<n;i++){
        if((ikun[i]%10-ikun[i]/1000-ikun[i]%1000/100-ikun[i]%100/10)>0) s++;
    }
cout<<s;
}

by liuli688 @ 2024-10-22 19:17:30

@tyt_

#include<bits/stdc++.h>
using namespace std;
    int ikun[110];
int main(){
    int n,s=0;
    cin>>n;
    for(int i=0;i<n;i++) cin>>ikun[i];
    for(int i=0;i<n;i++){
        if(ikun[i]%10-ikun[i]/10%10-ikun[i]/100%10-ikun[i]/1000>0) s++;
    }
cout<<s;
}

by tyt_ @ 2024-10-22 19:54:07

@liuli688 一样啊,而且我已经对了


|