1162
来源:互联网 发布:丹尼斯约翰逊数据 编辑:程序博客网 时间:2024/06/12 06:16
提交: 1200 解决: 206
[提交][状态][讨论版]
[提交][状态][讨论版]
题目描述
Give you a number named N; please tell me how many ways to arrive N use two square
integers.
输入
There are many of test cases. For each test case, just one line contains a number N
(1<=N<=1000000).
Proceed to the end of file.
输出
If there is no way to arrive N use two square numbers, please output “No Solution!”, and
else output an integer indicating the ways number.
样例输入
509
样例输出
21
提示
There is two ways to arrive number 50:
First: 50 = 1 + 49
Second: 50 = 25 + 25
There is one way to arrive number 9: 9 = 0 + 9
来源
2012黑龙江省赛
#include<stdio.h>#include <string.h>int N[1000001];int main(){ memset(N,0,sizeof(N)); int i,j,k; for (i=0;i<=1000;i++){ for (j=i;j<=1000;j++){ if ((i*i+j*j)>1000000) break; N[i*i+j*j]++; } } while(scanf("%d",&k)!=EOF) { if(N[k])printf("%d\n",N[k]); else printf("No Solution!\n"); } return 0;}
0 0
- 1162
- 1162
- hdu 1162
- hdu 1162
- HDU 1162
- hdu 1162
- ZOJ-1162
- hdu-1162
- hdu 1162
- 1162: 【密码】
- hdu 1162
- hdu 1162
- hdu 1162 prim算法
- Sicily 1162 Sudoku
- poj 1162 java
- UVA 1162 Transcript
- hdu 1162(Kruskal)
- hdu 1162 prim模板
- LDD之中断
- 数据结构与算法(C语言版)__冒泡排序
- 【解决】java.net.BindException: Address already in use: JVM_Bind
- 1116. Come on! Let's C (20)
- 使用hive来分析flume收集的日志数据
- 1162
- Out of memory on a 14745616-byte allocation.+Bitmap的内存优化
- 深入理解Express.js
- Java语言基础(六)之 —— 循环结构(do...while循环)
- Scroller的用法
- code(vs)1048 石子归并(区间dp)
- 1229
- 学习笔记---文件读写
- 51node 1001 数组中和等于K的数对