题解 | #Old Bill#

Old Bill

https://www.nowcoder.com/practice/17a30153e092493e8b4d13f321343927

#include <csetjmp>
#include <ios>
#include <iostream>
#include <ostream>
using namespace std;

int main() {
    int n, x, y, z;
    while (cin >> n) {//连续输入用这个
        cin >> x >> y >> z;
        int i, j;
        int tag = 0;//标记这种情况是否成立
        int total = 0;
        for (i = 9; tag == 0 && i > 0; i--) {
            for (j = 9; tag == 0 && j >= 0; j--) {
                total = j + z * 10 + y * 100 + x * 1000 + i * 10000;
                if (total % n == 0)  tag = 1;
            }
        }
        if (tag==1) {
            cout << ++i << " " << ++j << " " << total / n << endl;
        }else {
            cout<<"0"<<endl;
        }
        
    }

}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

烤点老白薯:他第二句话的潜台词是想让你帮他点个瑞幸或者喜茶啥的
mt对你说过最有启发的一...
点赞 评论 收藏
分享
12-24 20:46
武汉大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务