基础编程题目集 7-19 支票面额 (15分)

在这里插入图片描述

#include <cstdio>
#include <iostream>
using namespace std;
int y, f, n;
int main()
{
    scanf("%d", &n);
    y = (98 - n) / 3;
    f = 2 * y + 1;
    if ((98 - n) % 3 == 0)
        printf("%d.%d\n", y, f);
    else
    {
        for (int i = 0; i < 100; i++)
        {
            for (int j = 0; j < 100; j++)
            {
                if ((2 * i * 100 + 2 * j) == (j * 100 + i - n))
                {
                    printf("%d.%d\n", i, j);
                    return 0;
                }
            }
        }
        printf("No Solution\n");
    }

    return 0;
}
发布了287 篇原创文章 · 获赞 117 · 访问量 8933

猜你喜欢

转载自blog.csdn.net/qq_44458489/article/details/105400001