文章

1

粉丝

133

获赞

0

访问

3.6k

头像
邮票2穷举法
P1462 北京理工大学机试题
发布于2022年4月5日 18:00
阅读数 3.6k

#include
using namespace std;

int main(){
    int x=8,y=10,z=18;
    vector myvector;
    for(int a=0;a<=5;a++){//暴力穷举
        for(int b=0;b<=4;b++){
            for(int c=0;c<=6;c++){
                int ans=0;
                bool flag=false;//验证是否已经存在
                ans=a*x+b*y+c*z;
                for(int i=0;i                     if(ans==myvector[i])
                        flag=true;//若存在则设为true
        &nbs...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发