More than 2014 schools join-Eighth Session

Source: Internet
Author: User

100:2048

Obviously, I read the wrong question at the beginning... Sad

I think this question is quite time-consuming...

DP [I] [J]: When selecting 2 ^ I, the selected sum is J * 2 ^ I to (j + 1) * 2 ^ I-1.

# Include <iostream> # include <stdio. h> # include <vector> # include <queue> # include <stack> # include <string. h> # include <algorithm> # include <math. h> using namespace STD; # define ll _ int64 # define lcm (a, B) (a * B/gcd (a, B )) # define mod 998244353 # define maxn 110000 // O (n) calculates the prime number. the Euler's number of 1-N is int num [21]; ll DP [15] [2100]; ll Jie [maxn]; ll use [15] [2100]; int N; int add (int x) {If (x = 0) return 20; int C = 0; while (X! = 1) {If (X & 1) return 20; X = x> 1; C ++;} return C;} ll q_mod (ll a, ll B, ll N) {ll ret = 1; ll TMP = A % N; while (B) {// The base contains if (B & 0x1) ret = RET * TMP % N; TMP = TMP * TMP % N; B >>= 1;} return ret;} ll select (INT N, int m) {If (M> N) return 0; ll ans = Jie [N]; ans = (ANS * q_mod (Jie [m] * Jie [n-M]) % mod, mod-2, MoD) % MOD; return ans;} void select () {for (INT I = 1; I <= 11; I ++) {for (Int J = 0; j <2048; j ++) {use [I] [J] = select (Num [I-1], j) ;}} voi D DoS () {select (); For (Int J = 0; j <2048; j ++) DP [1] [J] = use [1] [J]; for (INT I = 2; I <12; I ++) {int CNT = 1 <(12-i); For (Int J = 0; j <CNT; j ++) {for (int K = 0; k <= J * 2 + 1; k + = 2) {DP [I] [J] + = (DP [I-1] [k] + dp [I-1] [k + 1]) * use [I] [J-k/2]) % MOD;} DP [I] [J] % = MOD;} ll ans = 0; ans = q_mod (2, num [20], MoD); ll ps = (DP [11] [0] + dp [11] [1]) % MOD; PS = q_mod (2, N-num [20], MoD)-PS; PS = (PS + mod) % MOD; ans = (ANS * PS) % MOD; cout <ans <Endl;} int Ma In () {// freopen ("1001.in"," r ", stdin); // freopen (" 10011.out", "W", stdout); int CAS = 0; int X; jie [0] = 1; for (INT I = 1; I <maxn; I ++) Jie [I] = (Jie [I-1] * I) % MOD; while (~ Scanf ("% d", & N) {memset (Num, 0, sizeof (Num); memset (DP, 0, sizeof (DP )); CAS ++; For (INT I = 1; I <= N; I ++) {scanf ("% d", & X); num [add (x)] ++;} printf ("case # % d:", CAS); DoS ();} return 0 ;}
1004: Kingdom

I regret not reading this question at the time .... Obviously, water problems ....

It is equivalent to topological sorting ..

The smallest entry point is displayed each time. There is no case of-1 at all... Cheated...

# Include <iostream> # include <stdio. h> # include <vector> # include <queue> # include <stack> # include <string. h> # include <algorithm> # include <math. h> using namespace STD; # define ll long # define lcm (a, B) (a * B/gcd (a, B) // O (n) Evaluate the prime number, 1-N records # define maxn 505int MP [maxn] [maxn]; vector <int> VEC; int du [maxn]; int N; void tuopu () {Vec. clear (); int I; while (1) {int now = 0; int Minn = 9999; for (I = 1; I <= N; I ++) {If (Du [I]> = 0 & Minn> Du [I]) {now = I; Minn = Du [I] ;}} if (now = 0) break; Vec. push_back (now); Du [now] =-1; for (I = 1; I <= N; I ++) {If (MP [I] [now]) du [I] --;} If (VEC. size () <n) cout <"-1" <Endl; else {for (INT I = Vec. size ()-1; I> = 0; I --) {printf ("% d", VEC [I]); if (I! = 0) printf (""); else puts ("") ;}} char STR [11001]; int main () {ll p, G, Y; // freopen ("1004.in"," r ", stdin); // freopen (" 10041.out", "W", stdout); While (~ Scanf ("% d", & N) {memset (DU, 0, sizeof (DU); For (INT I = 1; I <= N; I ++) {scanf ("% s", STR); For (Int J = 1; j <= N; j ++) {MP [I] [J] = STR [J-1]-'0'; If (MP [I] [J]) du [I] ++ ;}} tuopu ();} return 0 ;}
1007: multiplication table

This is the most damaging question in the entire game. At the beginning, there was a problem with the Train of Thought. Later on, it was always wrong...

Obviously, for different numbers, the first category is different.

# Include <iostream> # include <stdio. h> # include <vector> # include <queue> # include <stack> # include <string. h> # include <algorithm> # include <math. h> using namespace STD; # define ll long # define lcm (a, B) (a * B/gcd (a, B) // O (n) Evaluate the prime number, 1-N Euler's number int MP [2] [505] [505]; vector <int> VEC [505]; int ans [505]; int num [505]; int in () {char ch; int A = 0; while (CH = getchar () = ''| CH = '\ n '); A + = CH-'0'; while (CH = getchar () )! = ''& Ch! = '\ N') {A * = 10; A + = CH-'0';} return a;} int main () {// freopen ("1007.in ", "r", stdin); // freopen ("10071.out"," W ", stdout); int X, Y; int CAS = 0; int check [101]; int N; while (~ Scanf ("% d", & N) {CAS ++; memset (ANS,-1, sizeof (ANS); For (INT I = 0; I <n; I ++) {for (Int J = 0; j <n; j ++) {x = in (); y = in (); MP [0] [I] [J] = x; MP [1] [I] [J] = y; if (x = Y & X = I & I = J) {ans [0] = I ;}} for (INT I = 0; I <n; I ++) {If (MP [0] [I] [I] = ans [0] & MP [1] [I] [I]! = Ans [0] & MP [1] [I] [I] = I) {ans [1] = I; break ;}} for (INT I = 0; I <n; I ++) {VEC [I]. clear (); For (Int J = 0; j <n; j ++) VEC [I]. push_back (MP [0] [I] [J]); sort (VEC [I]. begin (), VEC [I]. end (); num [I] = 1; for (Int J = 1; j <VEC [I]. size (); j ++) {If (VEC [I] [J]! = VEC [I] [J-1]) num [I] ++;} If (Num [I]> 1) ans [num [I] = I ;} printf ("case # % d:", CAS); int leap = 0; For (INT I = 0; I <n; I ++) {printf ("% d", ANS [I]); If (ANS [I] =-1) leap = 1;} while (LEAP) {cout <check [110101010110] <Endl ;}cout <Endl ;}return 0 ;}









Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.