前言:

像我这样一直在DIV2的弱菜。。不知道说什么了。

A:一定判断有8个‘R’,每行 每列只有一个

B题:大概是  int E,int EM,int M,int MH,int H

然后EM可以给值到E,M,MH可以给值到H,M;

我的做法二分,然后判断。

C:遇到数论就跪。。

求a*x^2+b*x+c=0 (mod p);p=10^9;

不满足输出-1 a,b,c,x 都在【0,999999999】;

首先p=10^9本来就很特殊,所以从这里考虑

p=2^9*5^9;

f[x]=a*x^2+b*x+c;

先求出f[x1]=0 (mod 2^9);

然后 f[x1+2^9*k]=0 (mod 5^9);

因为求也能f[x1+2^9*k】=0(mod 2^9);所以满足

 #include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <vector> #define ll long long
#define ull unsigned long long
using namespace std; #define mod 1000000000
#define N 999999999 class PolynomialRemainder {
public: int findRoot(int a, int b, int c) {
ll x=;
ll mod1=<<;
ll mod2=;
for (int i=;i<=;i++) mod2*=; for (x=;x<mod1;x++)
if ((x*x*a+b*x+c) % mod1 ==) break; if (x==mod1) return -; for (;x<mod1*mod2;x+=mod1)
{
if ((x*x%mod2*a+b*x+c) % mod2 ==) return x;
}
return -;
}
};

所以关键是10^9的分化。

Topcoder SRM 657DIV2的更多相关文章

  1. TopCoder SRM 560 Div 1 - Problem 1000 BoundedOptimization & Codeforces 839 E

    传送门:https://284914869.github.io/AEoj/560.html 题目简述: 定义"项"为两个不同变量相乘. 求一个由多个不同"项"相 ...

  2. Topcoder SRM 643 Div1 250<peter_pan>

    Topcoder SRM 643 Div1 250 Problem 给一个整数N,再给一个vector<long long>v; N可以表示成若干个素数的乘积,N=p0*p1*p2*... ...

  3. Topcoder Srm 726 Div1 Hard

    Topcoder Srm 726 Div1 Hard 解题思路: 问题可以看做一个二分图,左边一个点向右边一段区间连边,匹配了左边一个点就能获得对应的权值,最大化所得到的权值的和. 然后可以证明一个结 ...

  4. TopCoder SRM 667 Div.2题解

    概览: T1 枚举 T2 状压DP T3 DP TopCoder SRM 667 Div.2 T1 解题思路 由于数据范围很小,所以直接枚举所有点,判断是否可行.时间复杂度O(δX × δY),空间复 ...

  5. Topcoder Srm 673 Div2 1000 BearPermutations2

    \(>Topcoder \space Srm \space 673 \space Div2 \space 1000 \space BearPermutations2<\) 题目大意 : 对 ...

  6. Topcoder Srm 671 Div2 1000 BearDestroysDiv2

    \(>Topcoder \space Srm \space 671 \space Div2 \space 1000 \space BearDestroysDiv2<\) 题目大意 : 有一 ...

  7. [topcoder]SRM 646 DIV 2

    第一题:K等于1或者2,非常简单.略.K更多的情况,http://www.cnblogs.com/lautsie/p/4242975.html,值得思考. 第二题:http://www.cnblogs ...

  8. [topcoder]SRM 633 DIV 2

    第一题,http://community.topcoder.com/stat?c=problem_statement&pm=13462&rd=16076 模拟就可以了. #includ ...

  9. TopCoder<SRM>上的一道1100分的题目解析附代码

    首先我们来简单看一下这道题的statement Problem Statement      Note that in the following problem statement, all quo ...

随机推荐

  1. SQL Server之增删改操作

    -------添加约束.增删改 use StudentDB2 go --------创建学生表--------- create table StudentInfo( --studentId int p ...

  2. zabbix实现自动发现功能添加磁盘监控

    zabbix实现对磁盘动态监控 - Lenwood 原文  http://www.cnblogs.com/baizhantang/p/3253246.html 主题 Linux命令 zabbix 前言 ...

  3. Activiti6简明教程

    一.为什么选择Activiti 工作流引擎对比 二.核心7大接口.28张表 7大接口 (一)7大接口 RepositoryService:提供一系列管理流程部署和流程定义的API. RuntimeSe ...

  4. C-基础:数组名与取地址符&

    指出下面代码的输出,并解释为什么.(不错,对地址掌握的深入挖潜) main() { ]={,,,,}; ); printf(),*(ptr-)); } 输出:2,5     *(a+1)就是a[1], ...

  5. MFC隐藏在黑暗之中的大坑

    大坑一:CDC会随着窗口状态的改变而改变 void K5::OnPaint() { CDC *pDC=this->GetDC(); //CDC最好设为局部变量 ... this->Rele ...

  6. eclipse修改SVN账号密码

    首先,eclipse中打开window------>preferences------->SVN页面,如下所示: 注意我圈起来的地方,JavaHL是不可用的,因此SVN接口应该是SVNKi ...

  7. ftp上传文件、删除文件、下载文件的操作

    FavFTPUtil.Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ...

  8. Linux文件查找find和locate

    目 录 第1章 locate文件查找    1 1.1 概述    1 1.2 locate文件查找的特性    1 第2章 文件查找概述    1 第3章    1 3.1 文件名查找    1 3 ...

  9. vue 单独页面定时器 离开页面销毁定时器

    data: { return { timer: null } }, created() { this.timer = setInterval(....); }, beforeDestroy() { i ...

  10. fit in gnuplot

    Table of Contents 1. fit-gnuplot 1 fit-gnuplot syntax >> fit [xrange][yrange] function 'datafi ...