Objective:
As I have been in the DIV2 of the weak dish. I don't know what to say.
A: It must be judged that there are 8 ' R ', only one per column per row
Question B: Probably int e,int em,int m,int mh,int H
Then em can give value to E,M,MH can give value to h,m;
I'm doing two points and then judging.
C: When encountering number theory, kneel.
Seek a*x^2+b*x+c=0 (mod p); p=10^9;
Not satisfied with the output-1 a,b,c,x are in "0,999999999";
First of all, p=10^9 is very special, so consider it from here.
p=2^9*5^9;
F[x]=a*x^2+b*x+c;
First Find out f[x1]=0 (mod 2^9);
Then f[x1+2^9*k]=0 (mod 5^9);
Because the request can also f[x1+2^9*k "=0 (mod 2^9);
1#include <iostream>2#include <cstdio>3#include <cmath>4#include <cstdlib>5#include <algorithm>6#include <cstring>7#include <vector>8 9 #definell Long LongTen #defineull unsigned long Long One using namespacestd; A - #defineMoD 1000000000 - #defineN 999999999 the - classPolynomialremainder { - Public: - + intFindRoot (intAintBintc) { -ll x=0; +ll mod1=1<<9; All mod2=1; at for(intI=1; i<=9; i++) mod2*=5; - - for(x=0; x<mod1;x++) - if((x*x*a+b*x+c)% Mod1 = =0) Break; - - if(X==MOD1)return-1; in - for(; x<mod1*mod2;x+=mod1) to { + if((x*x%mod2*a+b*x+c)% MOD2 = =0)returnx; - } the return-1; * } $};
So the key is 10^9 differentiation.
Topcoder SRM 657div2