数论
SSimpLe_Y
人一我百,人十我万,然而我做不到。
展开
-
POJ1265 Area
题目大意:给一个平面上的简单多边形,求边上的点,多边形内的点,多边形面积。解题思路:这个题用了很多知识点:1、以格子点为顶点的线段,覆盖的点的个数为GCD(dx,dy),其中,dxdy分别为线段横向占的点数和纵向占的点数。如果dx或dy为0,则覆盖的点数为dy或dx。2、Pick公式:平面上以格子点为顶点的简单多边形的面积=边上的点数/2+内部的点数+1。3原创 2016-08-02 19:42:37 · 359 阅读 · 0 评论 -
大数模板 (kuangbin模板的修订版)
以前直接用kuangbin的模板,发现一直过不了题,今天又做了一题,发现原来是减法函数里有一个地方写错了,改正之后就可以了(不保证其他的没有问题)。#include#include#include#include#define LL long longusing namespace std;/** 完全大数模板* 输出cin>>a* 输出a.print();* 注原创 2017-09-21 15:17:30 · 1655 阅读 · 6 评论 -
SGU 115. Calendar (基姆拉尔森公式)
irst year of new millenium is gone away. In commemoration of it write a program that finds the name of the day of the week for any date in 2001.InputInput is a line with two positive integer原创 2017-09-27 12:37:24 · 858 阅读 · 0 评论 -
1013: [JSOI2008]球形空间产生器sphere(高斯消元)
Description 有一个球形空间产生器能够在n维空间中产生一个坚硬的球体。现在,你被困在了这个n维球体中,你只知道球面上n+1个点的坐标,你需要以最快的速度确定这个n维球体的球心坐标,以便于摧毁这个球形空间产生器。Input 第一行是一个整数n(1后6位,且其绝对值都不超过20000。Output 有且只有一行,依次给出球心的n维坐标(n原创 2017-07-22 17:08:15 · 848 阅读 · 0 评论 -
lightoj 1341 - Aladdin and the Flying Carpet / lightoj 1236 - Pairs Forming LCM(算术基本定理)
1341 - Aladdin and the Flying CarpetIt's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first myster原创 2017-03-18 17:22:38 · 868 阅读 · 0 评论 -
lightoj 1336 - Sigma Function(算数基本定理)
Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(24) = 1+2+3+4原创 2017-06-27 17:04:47 · 1332 阅读 · 0 评论 -
lightoj 1370 - Bi-shoe and Phi-shoe(欧拉函数)
Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his assistant Bi-Shoe to go原创 2017-06-26 17:56:22 · 827 阅读 · 0 评论 -
lightoj 1220 - Mysterious Bacteria(算数基本定理)
Dr. Mob has just discovered a Deathly Bacteria. He named it RC-01. RC-01 has a very strange reproduction system. RC-01 lives exactly x days. Now RC-01 produces exactly p new deadly Bacteria where x =原创 2017-07-01 15:13:04 · 888 阅读 · 0 评论 -
lightoj 1282 - Leading and Trailing
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.InputInput starts with an integer T (≤ 1000), denoting the num原创 2017-06-30 20:14:53 · 1371 阅读 · 0 评论 -
lightoj 1138 - Trailing Zeroes (III)(N的阶层后有多少个零+二分)
You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N. For example, 5! = 120, 120 contains one zero on the t原创 2017-06-29 19:08:42 · 899 阅读 · 0 评论 -
lightoj 1102 - Problem Makes Problem(组合数+逆元)
As I am fond of making easier problems, I discovered a problem. Actually, the problem is 'how can you make n by adding k non-negative integers?' I think a small example will make things clear. Suppose原创 2017-01-16 17:55:51 · 804 阅读 · 0 评论 -
lightoj 1117 - Helping Cicada(容斥)
Cicada is an insect with large transparent eyes and well-veined wings similar to the "jar flies". The insects are thought to have evolved 1.8 million years ago during the Pleistocene epoch. There are原创 2017-01-14 20:58:49 · 914 阅读 · 0 评论 -
POJ 2635 The Embarrassed Cryptographer
DescriptionThe young and very promising cryptographer Odd Even has implemented the security module of a large system with thousands of users, which is now in use in his company. The cryptographic原创 2016-08-14 10:09:37 · 632 阅读 · 0 评论 -
POJ 3292 Semi-prime H-numbers(类素数筛法)
DescriptionThis problem is based on an exercise of David Hilbert, who pedagogically suggested that one study the theory of 4n+1 numbers. Here, we do only a bit of that.An H-number is a positive原创 2016-08-23 16:15:42 · 618 阅读 · 0 评论 -
最小公倍数取模
题目:求一个最小的整数,能被1~n中的所有数整除。n的范围为 1 <= n <= 100000,答案对1e9+7取模。 思路:一上来有些人可能认为可以先求最小公倍数然后再取模,这样显然是不可以的,因为求最小公倍数中有除法,除法是不能直接取模的,就算用了逆元,也是不对的。我们可以把每一个数进行质因数分解,之后求最小公倍数,最后用快速幂求出答案并取模就正确了。举个例子:...原创 2018-04-10 20:08:04 · 2202 阅读 · 1 评论