1078 - Integer Divisibility   PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the n…
题意: 给你一个n和一个数 digit ,问你最少需要多少个 digit 使得整除于n; 思路: 同余定理(a+b)%n=(a%n+b%n)%n; (m%n+m%n*10+m%n*100+m%n*1000......)%n==0; temp=m%n; temp=(temp*10+m)%n=(10*m%n+m%n)%n; temp=(temp*10+m)%n=(10*10*m%n+10*m%n+m)%n; if(temp==0) 满足: #include <bits/stdc++.h> usin…
题目大意: 输入n,m: ( 1 ≤ N ≤ 10000, 2 ≤ M ≤ 100 ) 接下来n个数:Each integer is not greater than 10000 by it's absolute value. 判断他们按顺序做加减法后能否整除m 若能输出“Divisible”,否则输出“Not divisible”: Sample Input Sample #14 717 5 -21 15 Sample #24 517 5 -21 15 Sample Output Sample…
提高自己的实力, 也为了证明, 开始板刷lightoj,每天题量>=1: 题目的类型会在这边说明,具体见分页博客: SUM=54; 1000 Greetings from LightOJ [简单A+B] 1001 Opposite Task  [简单题] 1002 Country Roads[搜索题] 1003 Drunk[判环] 1004 Monkey Banana Problem [基础DP] 1006 Hex-a-bonacci[记忆化搜索] 1008 Fibsieve`s Fantabu…
最近看到一个多线程面试题,有三个线程分别打印A.B.C,请用多线程编程实现,在屏幕上循环打印10次ABCABC- 看到这个题目,首先想到的是解决方法是定义一个Integer类对象,初始化为0,由3个线程共享,如果Integer对象取余3之后等于0,则打印A,同时进行加1操作:如果Integer对象取3之后等于1,则打印B,同时进行加1操作:如果Integer对象取3之后等于1,则打印C,如果循环打印了10次的话,就退出线程. /** * ThreeThread * 3个线程测试 */ publi…
Reverse Integer 想用余10直接算,没想到 -123%10 是 7, 原因 -123-(-123//10*10) r=a-n*[a/n] 以上,r是余数,a是被除数,n是除数. 唯一不同点,就是商向0或负无穷方向取整的选择,c从c99开始规定向0取整,python则规定向负无穷取整,选择而已. 所以套用上述公式为: C 语言:(a%n的符号与a相同) -9%7=-9 - 7*[-1]=-2: 9%-7=9 - -7*[-1]=2; Python语言::(a%n的符号与n相同) -9…
豪迈CuteRite(简称CR)优化板件后会生成SAW文件.MDB文件,SAW文件用于开料机开料,MDB文件中保存了有限的优化结果记录. 因为CR软件可以根据配置生成不同结构的mdb文件,所以以下内容仅供参考 表结构 详细表结构 序号 表 字段 数据类型 说明 1 批量浏览 运行索引 SMALLINT 在批量浏览表中的唯一性标识,其他表中的运行索引均关联次字段 2 批量浏览 运行 Text(200) 锯机文件号 3 批量浏览 工件 文件 Text(200) 批次号 4 批量浏览 已生产的工件 m…
链接: https://vjudge.net/problem/LightOJ-1078 题意: If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the number and the only allowable digit, you should report the…
http://lightoj.com/volume_showproblem.php?problem=1214 这就是一道简单的大数取余. 还想还用到了同余定理: 所谓的同余,顾名思义,就是许多的数被一个数d去除,有相同的余数.d数学上的称谓为模.如a=6,b=1,d=5,则我们说a和b是模d同余的.因为他们都有相同的余数1. //// 数学上的记法为: a≡ b(mod d) 可以看出当n<d的时候,所有的n都对d同商,比如时钟上的小时数,都小于12,所以小时数都是模12的同商. 对于同余有三种…
140. Integer Sequences time limit per test: 0.25 sec. memory limit per test: 4096 KB A sequence A is called an integer sequence of length N if all its elements A1 A2 .. AN are non-negative integers less than 2 000 000 000. Consider two integer sequen…
/** 题目:K - Large Division 链接:https://vjudge.net/contest/154246#problem/K 题意:判断a是否是b的倍数. a (-10^200 ≤ a ≤ 10^200) and b (|b| > 0, b fits into a 32 bit signed integer). 思路:取余: */ #include<iostream> #include<cstring> #include<cstdio> #in…
链接: https://vjudge.net/problem/LightOJ-1282 题意: You are given two integers: n and k, your task is to find the most significant three digits, and least significant three digits of nk. 思路: 后三位快速幂取余,考虑前三位. \(n^k\)可以表示为\(a*10^m\)即使用科学计数法. 对两边取对数得到\(k*log…
链接: https://vjudge.net/problem/LightOJ-1214 题意: Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a = b * c. 思路:…
http://lightoj.com/volume_showproblem.php?problem=1282 Leading and Trailing Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1282 Description You are given two integers: n and k, your task is t…
Divisibility Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 10598   Accepted: 3787 Description Consider an arbitrary sequence of integers. One can place + or - operators between integers in the sequence, thus deriving different arithmet…
Divisibility Time Limit: 2 Seconds      Memory Limit:65536 KB Consider an arbitrary sequence of integers. One can place + or - operators between integers in the sequence, thus deriving different arithmetical expressions that evaluate to different val…
http://lightoj.com/volume_showproblem.php?problem=1213  Fantasy of a Summation Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1213 Description If you think codes, eat codes then sometimes you…
工作中遇到一个简单的小问题,判断两个数是否整除,如果不整除,获取相关的余数. 习惯java的我毫不犹豫的写下了代码 public Boolean isDivisibility(Integer dividend,Integer divider) { return dividend % divider == 0; } 提交代码发现竟然提交不上?? 后来查看API发现apex中没有直接的%取余运算,所以如果想要取余以及判断是否整除需要其他方式,代码如下: public without sharing…
[Question] Reverse digits of an integer. Example: x = 123, return 321 x = -123, return -321 [My Solution] class Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ neg = 1 if x < 0: neg = -1 if x == 0:…
Aladdin and the Flying Carpet Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1341 Appoint description:  System Crawler  (2016-07-08) Description It's said that Aladdin had to solve seven myst…
A - Bi-shoe and Phi-shoe Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1370 Appoint description:  System Crawler  (2016-07-08) Description Bamboo Pole-vault is a massively popular sport in X…
 Extended Traffic Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1074 Appoint description:  System Crawler  (2016-05-03) Description Dhaka city is getting crowded and noisy day by day. Certai…
C. Divisibility by Eight time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a non-negative integer n, its decimal representation consists of at most 100 digits and doesn't conta…
Conquering Keokradong Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1048 Description This winter we are going on a trip to Bandorban. The main target is to climb up to the top of Keokradong.…
D - Harmonic Number Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1234 Description In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers: In th…
E - Help Hanzo Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1197 Description Amakusa, the evil spiritual leader has captured the beautiful princess Nakururu. The reason behind this is he ha…
B - Pairs Forming LCM Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1236 Description Find the result of the following code: long long pairsFormLCM( int n ) {    long long res = 0;    for( in…
Snowflake Snow Snowflakes Time Limit: 4000MS   Memory Limit: 65536K Total Submissions: 30529   Accepted: 8033 Description You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Y…
http://www.lightoj.com/volume_showproblem.php?problem=1013   Yes, you are developing a 'Love calculator'. The software would be quite complex such that nobody could crack the exact behavior of the software. So, given two names your software will gene…
http://www.lightoj.com/volume_showproblem.php?problem=1011 You work in a company which organizes marriages. Marriages are not that easy to be made, so, the job is quite hard for you. The job gets more difficult when people come here and give their bi…