ZOJ 3935 2016(水题)
2016-05-04 14:26
253 查看
题目:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=115189#problem/L
代码:
代码:
#include<stdio.h> #include<string.h> #include<math.h> using namespace std; int judge1(int x) { //printf("%d\n",(int)sqrt(2*x)); int t=(int)sqrt(2*x); if(t*(t+1)==x*2) return 1; return 0; } int judge2(int x) { int t=(int)sqrt(1+8*x); if(t*t==1+8*x) { if((1+t)%4==0) { return 1; } } return 0; } int main() { for(int i=2016; i<=990528; i++) { if((i%400==0)||(i%4==0&&i%100!=0)) { if(judge1(i)) { if(judge2(i)) { printf("%d\n",i); } } } } }
相关文章推荐
- AbstractSequentialList源码分析
- java枚举应用(一)
- HashMap循环遍历方式及其性能对比
- OpenStack 与 大数据的融合
- Java生成CSV文件实例详解
- 通过ip判断是否可以访问的程序
- 翻翻git之---实用的进度类自定义控件LoadingDrawable
- json对象与数组以及转换成js对象的方法
- Android aChartEngine使用方法
- 翻翻git之---实用的进度类自定义控件LoadingDrawable
- ajax中的一些参数的含义及用法
- jQuery中的ajax服务端返回方式详细说明
- 遇到问题时,如何跟客户沟通
- The main reborn ASP.NET MVC4.0: using CheckBoxListHelper and RadioBoxListHelper
- 第九周
- Mysql varchar长度问题
- 【笔记】play2定时任务设置
- 整理--梯度下降法
- 根文件系统(rootfs)梳理
- Java创建多线程的三种方法