poj 2196(水题)

#include<iostream>
#include<cstdio>
using namespace std;
bool test(int n){
    int p,s1,s2,s3;
    s1 = s2 = s3 = 0;
    p = n;
    while(p>0){
        s1 += p%10;
        p /= 10;
    }
    p = n;
    while(p>0){
        s2 += p%12;
        p /= 12;
    } 
    p = n;
    while(p>0){
        s3 += p%16;
        p/= 16;
    }
    if(s1==s2&&s2==s3)return true;
    return false;
}
int main(){
    int ans[10000],n = 0;
    for(int i=2992;i<10000;i++){
        if(test(i))ans[n++] = i;
    }
    for(int i=0;i<n;i++){
        printf("%d\n",ans[i]); 
    }
    return 0;
}

 

poj 2196(水题)

上一篇:vue打包icon和背景图片不显示的问题


下一篇:jmeter connect time out