Hust oj 1279 切蛋糕(简单数学)

来源:互联网 发布:不会函数能学编程吗 编辑:程序博客网 时间:2024/04/29 03:25
切蛋糕Time Limit: 1000 MSMemory Limit: 65536 KTotal Submit: 218(79 users)Total Accepted: 72(65 users)Rating: Special Judge: NoDescription有一个非常大的蛋糕,现在有一个圆形的杯子可以从正面倒扣到上面的方式把蛋糕分为一块一块的,杯子的厚度忽略不计。现在规定可以用杯子n次要求m个人每人至少分一块,是否能满足?Input

每行输入两个整数n, m(0 < n ,m< 10000000)

处理到文件结束

Output

输出结果占一行,满足的话输出所有人中某个人最多能得到多少块

否则输出”N\n”

Sample Input

1 2

1 3

Sample Output

1

N\n

问n个圆最多能把平面分成几份

#include<cstdio>#include<iostream>using namespace std;int main(){    long long int n,m;    while(~scanf("%lld%lld",&n,&m))    {        long long int sum = n*n - n + 2;        if(sum < m)            printf("N\\n\n");        else            printf("%lld\n",sum-m+1);    }}


0 0
原创粉丝点击