UVa 11461 - Square Numbers【数学,暴力】
2017-07-04 10:27
316 查看
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2456
下面给出AC代码:
题意
输入两个整数a和b,输出从a到b(包含a和b)的平方数的个数。直到输入0 0时程序结束分析:
如果一个数n是平方数,(double)sqrt(n)-(int)sqrt(n)<1e-6。下面给出AC代码:
#include <bits/stdc++.h> using namespace std; int main() { int n,m,i; while(scanf("%d%d",&n,&m)!=EOF) { int count=0; if(n==0&&m==0)break; for(i=(int)(sqrt(n-0.1))+1;i*i<=m;i++) { count++; } printf("%d\n",count); } return 0; }
相关文章推荐
- UVA 11461 - Square Numbers 数学水题
- UVa 11461 Square Numbers (简单数学)
- UVA 11461 - Square Numbers 数学水题
- UVA - 11461 Square Numbers
- UVALive 7267(数学暴力)
- uva 11461 数学
- UVALive 7511 L - Multiplication Table 数学模拟题,暴力
- (UVA - 11461) Square Numbers (区间统计转换为前缀统计)
- UVa 11461 - Square Numbers
- UVa 11461 - Square Numbers (水题)
- UVA 11461 - Square Numbers(数论)
- UVA - 11461-Square Numbers
- UVA 11461 - Square Numbers(水题)
- UVA 11461 Square Numbers——前缀和水题
- uva 617- Nonstop Travel(暴力+数学)
- uva 618 - Doing Windows(暴力+数学)
- uva 10620 - A Flea on a Chessboard(暴力+数学)
- UVA 12898 And Or 数学暴力
- uva 1069 - Always an integer(数学+暴力)
- Joking with Fermat's Last Theorem UVA - 12665 (数学,暴力)