The 2016 ACM-ICPC Asia Shenyang Regional Contest

A. Thickest Burger

大数 × 2 + 小数

#include <cstdio>
#include <algorithm>
using namespace std;

int T;
int A,B;
int main()
{
    scanf("%d",&T);
    for(int t=1; t<=T; t++)
    {
        scanf("%d%d",&A,&B);
        if(A<B) swap(A,B);
        printf("%d\n",A*2+B);
    }
    return 0;
}

  

B. Relative atomic mass

C. Recursive sequence

D. Winning an Auction

E. Counting Cliques

爆搜。vector[i] 记录与 i 有边且编号大于的点。

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn = 100 + 10;
const int maxm = 1000 + 100;

int n, m, k;
vector<int> v[maxn];
int from[maxm], to[maxm];
int G[maxn][maxn];
int d[maxn], node[maxn];
int tot, ans;

void DFS(int x, int start)
{
    if (tot == k) { ++ans; return; }

    int sz = v[x].size();
    for (int i = start; i < sz; i++)
    {
        int flag = 0;
        for (int j = 2; j <= tot; j++)
        if (!G[ node[j] ][ v[x][i] ]) { flag = 1; break; }

        if (flag) continue;

        node[++tot] = v[x][i], DFS(x, i+1), --tot;
    }
}

int main()
{
    int t;
    scanf("%d", &t);
    for (int ca = 1; ca <= t; ca++)
    {
        memset(d, 0, sizeof(d));
        for (int i = 1; i <= n; i++)
        {
            for (int j = i+1; j <= n; j++) G[i][j] = G[j][i] = 0;
            v[i].clear();
        }

        scanf("%d%d%d", &n, &m, &k);
        for (int i = 1; i <= m; i++)
        {
            scanf("%d%d", &from[i], &to[i]);
            d[ from[i] ]++, d[ to[i] ]++;
        }

        for (int i = 1; i <= m; i++)
            if (d[ from[i] ] >= k-1 && d[ to[i] ] >= k-1)
            {
                if (from[i] < to[i]) v[ from[i] ].push_back(to[i]);
                    else v[ to[i] ].push_back(from[i]);
                G[ from[i] ][ to[i] ] = G[ to[i] ][ from[i] ] = 1;
            }

        ans = 0;
        for (int i = 1; i <= n; i++)
        {
            tot = 1, node[1] = i;
            DFS(i, 0);
        }

        printf("%d\n", ans);
    }
}

  

F. Similar Rotations

G. Do not pour out

H. Guessing the Dice Roll

I. The Elder

J. Query on a graph

K. New Signal Decomposition

L. A Random Turn Connection Game

M. Subsequence

原文地址:https://www.cnblogs.com/ruthank/p/9745797.html

时间: 2024-08-30 09:27:03

The 2016 ACM-ICPC Asia Shenyang Regional Contest的相关文章

2016 ACM/ICPC Asia Regional Shenyang Online 1007/HDU 5898 数位dp

odd-even number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 388    Accepted Submission(s): 212 Problem Description For a number,if the length of continuous odd digits is even and the length

2016 ACM/ICPC Asia Regional Shenyang Online 1003/HDU 5894 数学/组合数/逆元

hannnnah_j’s Biological Test Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 802    Accepted Submission(s): 269 Problem Description hannnnah_j is a teacher in WL High school who teaches biolog

2016 ACM/ICPC Asia Regional Shenyang Online 1009/HDU 5900 区间dp

QSC and Master Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 859    Accepted Submission(s): 325 Problem Description Every school has some legends, Northeastern University is the same. Enter

2016 ACM/ICPC Asia Regional Shenyang Online &amp;&amp; hdoj5901 Count primes Lehmer

Count primes Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description Easy question! Calculate how many primes between [1...n]! Input Each line contain one integer n(1 <= n <= 1e11).Process to end of f

hdu 5868 2016 ACM/ICPC Asia Regional Dalian Online 1001 (burnside引理 polya定理)

Different Circle Permutation Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 208    Accepted Submission(s): 101 Problem Description You may not know this but it's a fact that Xinghai Square is

HDU 5889 Barricade 【BFS+最小割 网络流】(2016 ACM/ICPC Asia Regional Qingdao Online)

Barricade Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 997    Accepted Submission(s): 306 Problem Description The empire is under attack again. The general of empire is planning to defend his

2016 ACM/ICPC Asia Regional Dalian Online 1002/HDU 5869

Different GCD Subarray Query Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 681    Accepted Submission(s): 240 Problem Description This is a simple problem. The teacher gives Bob a list of prob

2016 ACM/ICPC Asia Regional Dalian Online 1006 /HDU 5873

Football Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 439    Accepted Submission(s): 157 Problem Description A mysterious country will hold a football world championships---Abnormal Cup

2016 ACM/ICPC Asia Regional Qingdao Online 1001/HDU5878 打表二分

I Count Two Three Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 782    Accepted Submission(s): 406 Problem Description I will show you the most popular board game in the Shanghai Ingress Resis

HDU 5873 Football Games 【模拟】 (2016 ACM/ICPC Asia Regional Dalian Online)

Football Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 802    Accepted Submission(s): 309 Problem Description A mysterious country will hold a football world championships---Abnormal Cup