#include<bits/stdc++.h>
using namespace std;
long long s[300];
long long exgcd(long long a,long long b,long long& x,long long& y){
if(!b){
x=1;
y=0;
return a;
}
long long d=exgcd(b,a%b,x,y);
long long t=x;x=y;y=t-a/b*y;
return d;
}
int main(){
long long t,i,a,b,c,d,k,tt,ok;
scanf("%lld",&t);
for(i=1;i<=t;i++)
scanf("%lld",&s[i*2-1]);
for(a=0;a<=10000;a++){
d=exgcd(a+1,10001,b,k);
c=s[3]-a*a*s[1];
if(c%d)continue;
tt=c/d;
b=b*tt%10001;
k*=tt;
ok=1;
for(i=1;i<=t;i++){
s[2*i]=(s[2*i-1]*a+b)%10001;
if(i!=1&&(s[2*i-2]*a+b)%10001!=s[2*i-1]){
ok=0;break;
}
}
if(ok==1){
for(i=1;i<=t;i++)
printf("%lld\n",s[i*2]);
return 0;
}
}
return 0;
}相关推荐
【HDLBits实战】从真值表到最优电路:SOP与POS形式在ECE241考题中的精妙应用
本文以HDLBits平台上的ECE241考题为例,详细讲解了如何从真值表出发,利用卡诺图化简技术,推导出最优的积之和(SOP)与和之积(POS)逻辑表达式。文章重点剖析了如何处理“无关项”以简化电路,并通过Verilog代码实现对比,阐述了SOP与POS形式在数字电路设计中的精妙应用与实战价值。
【NWERC2008】uva12169 Disgruntled Judge
枚举+扩展欧几里得
基于FPGA低频方波测量-频率与占空比
基于FPGA低频方波测量-频率与占空比
UVA 10161 - Ant on a Chessboard
题目大意:按照图的方式排数,输入一个数,输出这个数的位置。 解题思路:斜对角线有规律,其位置的坐标为奇数时往左变大,往下变小,偶数时往左变小,往下变大。来输出,因为范围比较大,所以要100000。 ac代码: #include using namespace std; int a[100005]={0, 1, 3}, goal; int main() { for (int i=3
VCS2018在Ubuntu20 18安装步骤
之前在Ubuntu20上下VCS,花了好几天时间,本来想写博客避免以后重复劳动。但由于各种原因拖了一两个月,这次由于疫情原因,期末考试推迟,所以就再次在Ubuntu18上下了VCS,顺便写博客记录。 以下VCS2018安装方法适用于 Ubuntu20、Ubuntu18,亲测可用。其他Linux发行版没试过,但应该步骤差不多。 文章目录安装包安装步骤1、建立安装路径,更改权限2、运行安装器进行安装3、生成License文件4、设置环境变量5、验证License6、启动lmgrd验证软件是否安装成功dvever
NRF52832调试方法1——HardFault_Handler问题定位
一、遇到问题 keil debug模式下,直接点击全速运行(Run)发现程序卡死,点击stop按钮后,停到了HardFault_Handler位置,如下图所示。 此时使用navigate backwards(蓝色左箭头)是无效的,找不到程序卡在哪里。 二、解决办法 此时首先观察register窗口 若Stack为MSP,则复制R13(SP)的值到memory观察窗的地址搜索栏。每一行显示连续的28个地址上的存储信息,每个地址上存有一个字节。 从第21个位置起的连续四个字节是LR的值,
【UVA】12169-Disgruntled Judge(暴力or欧几里得)
可能由于后台数据的原因,这道题直接暴力枚举a,b进行判断也能过,不过跑的时间长,效率太差了。 14021006 12169 Disgruntled Judge Accepted C++ 0.876 2014-08-11 08:46:28 不说了,比较无脑。 #include #include #include #incl
Python调用CANoe
我们可以创建CANoe应用程序对象,打开配置文件,启动模拟,发送和接收消息,并在完成后关闭CANoe应用程序。这使得我们能够使用Python自动化执行测试任务,并集成CANoe的功能到我们的Python应用程序中。CANoe是一款功能强大的汽车网络仿真和测试工具,它能够模拟和分析汽车网络通信,并提供丰富的测试功能。通过Python编程语言,我们可以方便地调用CANoe的API,实现自动化测试和集成CANoe的功能到我们的Python应用程序中。在CANoe中,我们可以为不同的汽车网络创建配置文件。
UVa12169 - Disgruntled Judge(模运算)
如果知道了a,就能算出x2,根据x3=(ax2+b)mod10001算出b。 然后可在O(T)时间内计算出整个序列。 如果在计算中发现和输入矛盾,则a非法,因为a是0~10000的整数,即使枚举所有a,时间效率也足够高。 枚举a,利用x1,x3求出b,判断所有x的关系能不能满足a,b。 如何通过a,x1,x3求出b呢。 x2 = (a * x1 + b) % 10001; x3 =
【Unity优化篇】| Unity3D场景 常用优化策略,遮挡剔除、层消隐距离技术 和 LOD多层次细节
本篇文章来简单介绍一下 Unity中几种常用3D场景优化策略 方法 对于整个项目来说,本文中出现的方法也只是冰山一角,慢慢积累学习吧! 内容包括遮挡剔除(Occlusion Culling)、层消隐距离技术 和 LOD多层次细节
AgentScope Java 入门:Spring AI Alibaba 与 AgentScope 的定位与区别
摘要:Spring AI Alibaba是阿里基于Spring AI开发的本地化AI应用框架,旨在服务Java开发者。它提供模型接入、函数调用、RAG等功能,并与阿里云基础设施深度集成。同时,阿里开源了多智能体框架AgentScope,其Java版(AgentScope-Java)专注于Agentic设计理念。两者将协同发展:Spring AI Alibaba侧重Spring生态集成,AgentScope-Java强化智能体能力。未来计划包括支持AgentScope、升级Admin平台,以及推进Server
UVa 12169 Disgruntled Judge
exgcd
GeoServer改造Springboot源码一(公共部分)
今天开始开启关于GeoServer的一个全新系列,主要是把改造Springboot后的详细代码粘贴出来,此文应配合《》系列共同阅读,按照前系列的时间顺序结合此系列的源码展示可以快速构建GeoServer功能的二次封装的后端系统。
例题 10-2 不爽的裁判(Disgruntled Judge, NWERC 2008, UVa12169)
原题链接:https://vjudge.net/problem/UVA-12169 分类:暴力求解 备注:模算数 据说可以用扩展欧几里得 import java.util.Scanner; public class Main{ // static private final String INPUT = "in.txt"; public static final int mod=10001; public static void main(String[] args) { // FileInputS
全球国家地区城市数据
MySQL全球国家地区城市数据报。。。。。。。。。。。。
Data-Structures-and-Algorithm-Analysis-in-Java.pdf
作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...
Disgruntled Judge UVA - 12169(数学,枚举)
Once upon a time, there was an NWERC judge with a tendency to create slightly too hard problems. As a result, his problems were never solved. As you can image, this made our judge somewhat frustrated....
jre9下载 jdk9
(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】
UVA 12169 Disgruntled Judge (拓展欧几里德)
Once upon a time, there was an nwerc judge with a tendency to create slightly too hard problems. As a result, his problems were never solved. As you can image, this made our judge somewhat frustrate
Devexpress16.2.6破解工具
Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具
Uva 12169 Disgruntled Judge 扩展欧几里得,暴力
Once upon a time, there was an NWERC judge with a tendency to create slightly too hard problems. As a result, his problems were never solved. As you can image, this made our judge somewhat frustrated.
uva 12169 Disgruntled Judge
暴力或扩展欧几里德算法
UVA 12169 Disgruntled Judge (扩展欧几里得)
大体题意: 给你n 个数 x1,x3,,,x2n-1 让你确定出x2,x4,,,x2n来! x数列每一项满足 xi = ((x(i-1) * a ) + b ) % 10001; 思路: 我们枚举a,因为对10001取模,所以a肯定在0~10000以内有解! 那么我们就枚举a,对于每一项a,我们根据x3和x1求出b来,然后开始枚举每一项看看这个a和b 是否合适!合适就输出终止枚举!
UVa 12169 Disgruntled Judge(扩展欧几里得算法的应用)
12169 - Disgruntled Judge Time limit: 3.000 seconds Once upon a time, there was an NWERC judge with a tendency to create slightly too hard problems. As a result, his problems were nev
UVa12169 Disgruntled Judge
例题10-2 不爽的 裁判( Disgruntled Judge, NWERC 2008, UVa12169) 有个裁判出的题太难, 总是没人做, 所以他很不爽。 有一次他终于忍不住了 , 心 想: “反正我的题没人做, 我干嘛要费那么多心思出题? 不如就输入一个随机数, 输出一个 随机数吧。 ” 于是他找了 3个整数x1、 a和b, 然后按照递推公式xi=(axi-1+b) mod 1...
UVA-12169 Disgruntled Judge(扩展欧几里得)
Disgruntled Judge Once upon atime, there was an NWERC judge with a tendency to create slightly too hardproblems. As a result, his problems were never solved. As you can image, thismade ou
uva 12169 - Disgruntled Judge(暴力or欧几里得 )
原题链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=243&problem=3321&mosmsg=Submission+received+with+ID+17645520 解法一:暴力枚举: #include #include
例题6-18 雕塑 UVa12171
1.题目描述:点击打开链接
Once Upon a Time in America
近四个小时的电影,下载得累,看得人也累不过由于是好的电影,累也值得 电影中时间的转换穿插是相当的频繁和迅速的所以稍不留神,就会不知所云因此我是精神高度集中的坚持了4个小时好几个地方还往回拖了几次总算是把电影看懂了我也就不多加评论了因为虽说看懂了,要用文字写下来,还是蛮难得转载一篇吧 http://ent.tom.com/Archive/1002/1353/200
NWERC 2012 练习赛题解
题目: http://pan.baidu.com/s/1eMgpC A - Admiral 题意: 有V(2 题解: 陈题...拆点..起点和终点做边容量为2..费用为0
219




被折叠的 条评论
为什么被折叠?



