求问大佬这个RE问题出在哪

P1618 三连击(升级版)

Ghjk9452 @ 2019-11-25 21:18:31

代码如下是参考的三连击本体的思路

#include<iostream>
//#include<algorithm>
//#include<vector>
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int flag = 0;
    for(int i = 100; i < 999; i++){
        if(i % a != 0)
            continue;
        else{
            int s[10] = {0};
            int t1 = i/a*b, t2 = i/a*c;
            s[i%10] = 1;
            s[i/10%10] = 1;
            s[i/100] = 1;
            s[t1%10] = 1;
            s[t1/10%10] = 1;
            s[t1/100] = 1;
            s[t2%10] = 1;
            s[t2/10%10] = 1;
            s[t2/100] = 1;
            int val = 0;
            for(int i = 1; i < 10; i++)
                val += s[i];
            if(val == 9){
                cout << i << " " << t1 << " " << t2 << endl;
                flag = 1;
            }
        }
    }
    if(flag == 0)
        cout << "No!!!";
    return 0;
}

by Ghjk9452 @ 2019-11-25 21:19:49

前面四个点都过了,但是最后一个点提示RE 我按照数据123 456 789试了一下,觉得应该没问题啊


by ZZZZZZZF @ 2019-11-25 22:48:38

简单看了一下,好像是0模了个数


by Ghjk9452 @ 2019-11-26 13:55:19

@许郅斐 能具体说一下吗,我觉得没有0模啊,况且0模数有啥问题吗(linux下0%数为0啊)


|