HDU 5832 A water problem (大数取模)_LzyRapX的博客-程序员宅基地

技术标签: HDUOJ  HDU  ACM_计算  5832  A water problem  大数取模  

A water problem

Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 496    Accepted Submission(s): 26

Problem Description
Two planets named Haha and Xixi in the universe and they were created with the universe beginning.
There is 73 days in Xixi a year and 137 days in Haha a year.
Now you know the days N after Big Bang, you need to answer whether it is the first day in a year about the two planets.

Input
There are several test cases(about 5 huge test cases).
For each test, we have a line with an only integer N(0N) , the length of N is up to 10000000 .
Output
For the i-th test case, output Case #i: , then output "YES" or "NO" for the answer.
Sample Input
  
  
   
10001 0 333
Sample Output
  
  
   
Case #1: YES Case #2: YES Case #3: NO
Author
UESTC
Source
Recommend
wange2014   |   We have carefully selected several similar problems for you:  5842 5841 5840 5838 5837 

题解:如果这个数能%73=0和%137=0,就输出YES。否则NO

代码:
#pragma comment(linker, "/STACK:102400000,102400000")
//#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
#include<map>
#include<cmath>
#include<queue>
#include<set>
#include <utility>
#include<stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define mst(a) memset(a, 0, sizeof(a))
#define M_P(x,y) make_pair(x,y)  
#define rep(i,j,k) for (int i = j; i <= k; i++)  
#define per(i,j,k) for (int i = j; i >= k; i--)  
#define lson x << 1, l, mid  
#define rson x << 1 | 1, mid + 1, r  
const int lowbit(int x) { return x&-x; }  
const double eps = 1e-8;  
const int INF = 1e9+7; 
const ll inf =(1LL<<62) ;
const int MOD = 1e9 + 7;  
const ll mod = (1LL<<32);
const int N = 1010;
const int M=100010; 
template <class T1, class T2>inline void getmax(T1 &a, T2 b) {if(b>a)a = b;}  
template <class T1, class T2>inline void getmin(T1 &a, T2 b) {if(b<a)a = b;}
int read()
{
	int v = 0, f = 1;
	char c =getchar();
	while( c < 48 || 57 < c ){
		if(c=='-') f = -1;
		c = getchar();
	}
	while(48 <= c && c <= 57) 
		v = v*10+c-48, c = getchar();
	return v*f;
}
char s[10000100];
int main() 
{
    #ifndef ONLINE_JUDGE
    freopen("in.txt","r",stdin);
    #endif
	int cas = 1;
	while(gets(s)){
		int num = 0;
		for(int i=0; i<strlen(s); i++)
		{
			num=(num *10 + s[i]-'0') %10001;
		}
		if(num==0) printf("Case #%d: YES\n",cas++);
		else printf("Case #%d: NO\n",cas++);
	}
	return 0; 
}


 
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/liangzhaoyang1/article/details/52209800

智能推荐

记一年前端小白面经-程序员宅基地

起点从去年2017年7月毕业至今将近快1年的时间了,2018年5月底6月初开始面试,一共面了快手,滴滴,头条。很幸运每家都面完了3轮技术+1轮hr,能跟这么多大牛聊天真是太有收获了,对基础是一次查漏补缺,对技术视野也是一次提升,于是就想记录一下这些面试的问题与收获,有一些问题值得更加深入的研究的。问题由于已经过了些时日,仅记录问题而...

grub学习(3) 加载initrd-程序员宅基地

grub_err_tgrub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[]){ struct linux_kernel_header *lh; /* 打开initrd并计算其需要的页面 */ file = grub_file_open (argv[0]); size = grub_file_size (file); initrd_pages = (page_ali...

iOS进阶_Socket(Socket简介&代码演练)_ios 源码进阶-程序员宅基地

网络通讯三要素TCP &amp; UDP三次握手断开连接的四次握手Socket套接字了解了上面的概念,我们开始演练一下Socket#import "ViewController.h"#import &lt;sys/socket.h&gt;#import &lt;netinet/in.h&gt;#import &lt;arpa/i..._ios 源码进阶

winfrom 把html作为内容发送邮件,发送Html邮件-程序员宅基地

public bool Sendmail(string name,string pwd { try { // StreamReader sr = new StreamReader("D:\\aaaa.html"); // string s = sr.ReadLine()

《程序员的自我修养》番外笔记——符号解析与重定位-程序员宅基地

程序如下:重定位先来看这段代码的反汇编结果。"main"的起始地址为0x00000000,这是因为在未进行空间分配之前,目标文件代码段中的起始地址以0x00000000开始,等到空间分配完成以后,各个函数才会确定自己在虚拟地址空间中的位置。偏移为0x18的地址上是一条mov指令,总共8个字节,它的作用是将“shared”的地址赋值到esp寄存器+4的偏移地址中去,前面4...

笔记:创意课_树莓派安全帽检测系统-程序员宅基地

第一课该课程来源于百度飞桨领航团Al达人创造营,笔记为个人所总结学习地址一、让人拍案叫绝的创意都是如何诞生的1.创意就是将现有想法进行某种组合多种事物特征的组合,例子:美人鱼、天使、恶魔、龙、人外娘、克苏鲁…2.趣味项目:游戏复刻三维弹球人脸版、Flappy Bird魔改(强化学习)、是男人就坚持一百关体感版以及后续版本二仙桥等特效复刻分割模型采集图像、放大镜特效加人脸识别、用二分类法更换天空场景效果复刻时间域+空间域的叠加、人体分割、头部检测、人脸检测…表情机器人接收照片_树莓派安全帽检测系统

随便推点

Java Set集合使用方法介绍(1)——在集合中插入字符串-程序员宅基地

Javaimport java.util.HashSet;import java.util.Iterator;import java.util.Set;public class WorfDemo { public static void main(String[] args) { // 将英文单词添加的HashSet中 Set set =

【FME-HOW-TO系列】25 多边形中的线_fme spatial-程序员宅基地

概述在本练习中,您将使用SpatialFilter设置空间谓词,以确定哪些线要素与多边形要素相交。SpatialFilter会比较两组要素,以查看它们的空间关系是否符合所选的测试条件。正在测试的要素((Candidate要素)被识别为已通过或未通过测试。例如,如果您有道路数据集(线),并且想要提取通过公园(多边形)的所有道路,您可以将道路引导到Candidate输入端口,并将公园引导到Filt..._fme spatial

PB的Graph图形控件_pb中怎样用图片控件-程序员宅基地

Graph图形控件【其他】■轴类型轴--Category--String型、数值型、Date型、Datetime型和Time型值轴--Value--数值型、Date型、Datatime型和Time型系列轴--Series--String型■图形外观PowerBuilder提供了17种图形外观,可以粗略划分为平面图形和立体图形两大类,也可以更细致地划分为5类,即(1)条型、列型(..._pb中怎样用图片控件

oracle+12170+tns+超时,[Oracle] [ODBC] [Ora] ORA-12170:TNS:发生连接超时错误[IM006] [Microsoft] [ODBC驱动程序管理器]驱动程..._许汉光的博客-程序员宅基地

我创建了一个SSIS包,用于将数据从Oracle数据库提取到SQL Server数据库 . 我在本地计算机和服务器上成功 Build 了ODBC连接,我可以在两种环境下使用sqlplus连接到Oracle数据库 . 我的包在我的本地机器上正常运行 . 当我从服务器上的Package store运行它时,它也成功执行但问题是当我以sql作业运行包时出现此错误:描述:System.Data.Odbc...._error [hy000] connect failed error [im006] [microsoft][odbc 驱动程序管理器]

ASP.NET中maxRequestLength和maxAllowedContentLength的区别;上传大文件设置IIS7文件上传的最大大小-程序员宅基地

maxRequestLength表示ASP支持的最大请求大小,而maxAllowedContentLength指定IIS支持的请求中内容的最大长度。因此,要上传大文件,我们需要同时设置这两个参数:较小的那个“优先”,即最终支持上传的文件的大小根据maxRequestLength和maxAllowedContentLength中的较小值而定。如果文件长度小于maxAllowedContentLen..._maxallowedcontentlength

LOL(英雄联盟)提示不支持虚拟机登录,解决方法_esxi不让打lol-程序员宅基地

LOL(英雄联盟)提示不支持虚拟机登录,解决方法_esxi不让打lol