zoukankan      html  css  js  c++  java
  • A water problem

    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
    大整数取余。对10001取余,10001是73和137的最小公倍数。
     1 #include <cstring>
     2 #include <cstdio>
     3 #include <iostream>
     4 #include <algorithm>
     5 #include <cmath>
     6 #include <stack>
     7 #include <vector>
     8 #include <queue>
     9 #include <cmath>
    10 using namespace std;
    11 #define N 10500000
    12 typedef long long LL;
    13 int a[N],b[N];
    14 int len;
    15 
    16 int main()
    17 {
    18 
    19 
    20     int i=1;
    21     char str[N];
    22     while(scanf("%s", str) != EOF)
    23     {
    24 
    25         int d = 10001;
    26         int ans = 0;
    27         for(int j = 0; str[j]; j++)
    28             ans = (ans * 10 + (str[j] - '0') % d) % d;
    29 
    30 
    31         if( ans == 0)
    32             printf("Case #%d: YES
    ", i++);
    33         else
    34             printf("Case #%d: NO
    ", i++);
    35     }
    36     return 0;
    37 }
     
  • 相关阅读:
    每天问自己十个问题
    FreeBSD入门安装及汉化
    商人的10条赚钱规则
    端口扫描程序nmap使用手册
    canvas
    表单2.0
    H5数据保存之storage
    Linux基础命令2
    Linux文件权限与修改
    Linux基础命令1
  • 原文地址:https://www.cnblogs.com/biu-biu-biu-/p/5770033.html
Copyright © 2011-2022 走看看