数论初步
unclever_mine
这个作者很懒,什么都没留下…
展开
-
NYOJ 1013-除法表达式
给出一个这样的除法表达式:X1/X2/X3/···/Xk,其中Xi是正整数。除法表达式应当按照从左到右的顺序求和,例如表达式1/2/1/2的值为1/4。但是可以在表达式中嵌入括号以改变计算顺序,例如表达式(1/2)/(1/2)的值为1.输入描述:首先输入一个N,表示有N组测试数据, 每组数据输入占一行,为一个除法表达式, 输入保证合法。 使表达式的值为整数。k<=10000,Xi<=1...原创 2018-05-09 22:09:34 · 245 阅读 · 0 评论 -
直线上的点(扩展欧几里得算法)
问题描述:求直线ax+by+c=0上有多少个整数点(x,y)满足x属于[x1,x2],y属于[y1,y2]。问题分析:算法竞赛入门经典P313#include <iostream>#include<cstdio>using namespace std; //欧几里得算法 int gcd(int a,int b){ return b==0?a:gcd(b,a%b);}//扩展...原创 2018-05-10 18:51:46 · 343 阅读 · 0 评论 -
幂取模
Calculate for large values of B, P, and M using an efficient algorithm. (That's right, this problem has a time dependency !!!.) input Three integer values (in the order B, P, M) will be read one ...原创 2018-05-10 23:24:42 · 150 阅读 · 0 评论 -
大整数取模
n<=10的100次方,m<=10的9次方#include<bits/stdc++.h>using namespace std; int main() { char n[105]; int m; scanf("%s%d",n,&m); int len=strlen(n); int ans=0; for(int i=0;i<len;i++){ ans=(int...原创 2018-05-10 23:26:43 · 404 阅读 · 0 评论