安全问答

安全问答是一个知识全球问答,包含丰富的问答知识

首页 常规 游戏 娱乐 科技 程序员

cpp题目:8443 无限回转关卡:枚举时空限制CPU占用时长 1秒内存使用限制 128MB题目描述给定两个整数 ��SP问是否有正整数对 ��xy使得�×�=�x×y=S 且 2×�+�=�2×x+y=P如果有则输出 Yes并在第二行输出满足 �x 最小的两个整数否则则输出 No输入格式第一行两个整数 ��SP中间用空格隔开输出格式第一行一个字符串 Yes 或 No 表示是否有满足条件的整数对如

  • 日期: 2028-06-06
  • 标签: 社会

#include using namespace std;

int main() { int N, S, P; cin >> N >> S >> P;

bool found = false;
int x = 1, y = S;
while (x <= y) {
    if (x * y == S && 2 * (x + y) == P) {
        found = true;
        break;
    }
    x++;
    y = S / x;
}

if (found) {
    cout << "Yes" << endl;
    cout << x << " " << y << endl;
} else {
    cout << "No" << endl;
}

return 0;

}

cpp题目:8443 无限回转关卡:枚举时空限制CPU占用时长 1秒内存使用限制 128MB题目描述给定两个整数 ��SP问是否有正整数对 ��xy使得�×�=�x×y=S 且 2×�+�=�2×x+y=P如果有则输出 Yes并在第二行输出满足 �x 最小的两个整数否则则输出 No输入格式第一行两个整数 ��SP中间用空格隔开输出格式第一行一个字符串 Yes 或 No 表示是否有满足条件的整数对如

原文地址: https://www.cveoy.top/t/topic/ixpG 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录

  • 上一篇: Building wheels for collected packages opencv-python Building wheel for opencv-python pyprojecttoml error ERROR Command errored out with exit status 1 command cusersthinkappdatalocalprogramspytho
  • 下一篇: iOS开发 时间秒数计算当前时间对比剩余时间 输出天小时分钟 oc代码

© 2019 • 2025 - 安全问答 站长邮箱:wxgpt@qq.com    ICP备案/许可证号:豫ICP备2024104334号-2