RCC 2014 Warmup (Div. 2)_html/css_WEB-ITnose

WBOY
풀어 주다: 2016-06-24 12:05:58
원래의
1147명이 탐색했습니다.

A题:看是全用c好还是全用d好还是都用的问题最少,注意 n * m

B题:题意坑死了,就开一个vis数组记录每个人前面的提交数,如果矛盾就false

C题:构造,只要判断n - k 是否

D题:状压DP,按k排序,然后dp数组只要记录完成集合,利用滚动数组优化空间,然后每次加上k * d去取最小值即可

E题:构造问题,不过用随机算法貌似更简便。构造出来的矩阵应该是

a a a a a b

a a a a a b

a a a a a b

c c c c c d

这样的,然后只要去随机a, b, c, d判断每行每列和是不是完全平方数即可

代码:

A:

#include <stdio.h>#include <string.h>#include <math.h>2 #define min(a,b) ((a)  <br> B:  <p></p>  <p></p>  <pre name="code" class="sycode">#include <stdio.h>#include <string.h>const int N = 100005;int n, vis[N];struct Solu {    int x, k;} s[N];bool judge() {    memset(vis, 0, sizeof(vis));    for (int i = 0; i  vis[k])            return false;    }    return true;}int main() {    scanf("%d", &n);    for (int i = 0; i   <br> C:  <p></p>  <p></p>  <pre name="code" class="sycode">#include <stdio.h>#include <string.h>int n, k;int main() {    scanf("%d%d", &n, &k);    if ((n - k)  n) b -= n;                printf("%d %d\n", a, b);            }        }    }    return 0;}</string.h></stdio.h>
로그인 후 복사

D:

#include <stdio.h>#include <string.h>#include <algorithm>#define min(a,b) ((a)  <br> E:  <p></p>  <p></p>  <pre name="code" class="sycode">#include <cstdio>#include <cstring>#include <cmath>#include <cstdlib>int n, m;bool check(int num) {    int m = (int)sqrt(num);    return m * m == num;}int main() {    scanf("%d%d", &n, &m);    int a, b, c, d, i, j;    while (1) {        a = rand() % 100 + 1;        b = rand() % 100 + 1;        c = rand() % 100 + 1;        d = rand() % 100 + 1;        if (check((m - 1) * a * a + b * b) &&             check((m - 1) * c * c + d * d) &&             check((n - 1) * a * a + c * c) &&             check((n - 1) * b * b + d * d))            break;    }    for (i = 0; i   <br>  <br>  <p></p>  <p><br> </p> </cstdlib></cmath></cstring></cstdio>
로그인 후 복사
관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!