题解 | #Old Bill#

Old Bill

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

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int N;
    int x,y,z;
    scanf("%d",&N);
    scanf("%d %d %d",&x,&y,&z);
    int value=0,curr=0;
    int fadedFore=-1,fadedLast=-1;

    for(int maxPos=1;maxPos<10;maxPos++){
        for(int minPos=0;minPos<10;minPos++){

            int price=maxPos*10000+x*1000+y*100+z*10+minPos;
            if (price%N==0){
                curr=price/N;

            if (curr>value){
                value=curr;
                fadedFore=maxPos;
                fadedLast=minPos;
            }
            }
        }
    }
    if(fadedFore==-1||fadedLast==-1){
            printf("0\n");
            return 0;
    }
    
    printf("%d %d %d",fadedFore,fadedLast,value);
}

全部评论

相关推荐

06-13 10:15
门头沟学院 Java
想去夏威夷的大西瓜在...:我也是27届,但是我现在研一下了啥项目都没有呀咋办,哎,简历不知道咋写
点赞 评论 收藏
分享
陆续:不可思议 竟然没那就话 那就我来吧 :你是我在牛客见到的最美的女孩
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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