1. 程式人生 > >4636 Cubist Artwork

4636 Cubist Artwork

題意:給你正檢視,和側檢視,求最好的組成放塊個數

思路:當正檢視的對應部分跟測檢視的對應部分相等的時候,那麼就可以當成一個來處理

題目的圖有給出這一細節

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 30;

int num1[MAXN],num2[MAXN];
int n,m;

int main(){
    while (scanf("%d%d",&m,&n) != EOF && n+m){
        memset(num1,0,sizeof(num1));
        memset(num2,0,sizeof(num2));
        int x;
        for (int i = 0; i < m; i++){
            scanf("%d",&x);
            num1[x]++;
        }
        for (int i = 0; i < n; i++){
            scanf("%d",&x);
            num2[x]++;
        }
        int ans = 0;
        for (int i = 1; i < 25; i++)
            ans += i*max(num1[i],num2[i]);
        printf("%d\n",ans);
    }
    return 0;
}


相關推薦

4636 Cubist Artwork

題意:給你正檢視,和側檢視,求最好的組成放塊個數 思路:當正檢視的對應部分跟測檢視的對應部分相等的時候,那麼就可以當成一個來處理 題目的圖有給出這一細節 #include <iostream> #include <cstdio> #include &

UVa LA 4636 Cubist Artwork 難度: 0

要求 epo cst show 從大到小 problem index.php namespace pri 題目 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8

NCPC2016-A-ArtWork

int 分享圖片 include temp open then 題意 nbsp aps 題目描述 A template for an artwork is a white grid of n × m squares. The artwork will be c

計蒜客 A.Artwork 並查集+set

連結:點選開啟連結 題意:畫直線分割槽域,問每畫完一條線有幾個區域 思路:倒著做變成擦直線,合併區域或形成新區域。可以使用並查集來維護。啟發:類似拆分的問題都可以倒過來離線變成合並的問題。 程式碼: #include<bits/stdc++.h> #define

Artwork Gym

題目描述: 有一個n*m的格子,有q個查詢,每次塗一條線的格子,問你每次後聯通塊的數目 分析: 可以倒著想,先把q次操作塗滿,然後求出聯通塊的數目,每次刪掉格子後,如果這個格子還是黑色,不處理,如果是白色 1)如果四周都是黑色,聯通塊數目加一 2)如果有白色,每

ArtWork (並查集 處理 方格陣的連通塊數量)

3030: ArtWork 時間限制: 4 Sec  記憶體限制: 128 MB 提交: 43  解決: 17 [提交] [狀態] [討論版] [命題人:外部匯入] 題目描述 A template for an artwork is a white grid of

How to Recreate the Banksy Artwork Shredder Using CSS Grid

On Friday, Banksy pranked the world again by shredding “Girl With Balloon” immediately after it fetched $1.4 million in auction. While everyone debates if

Is Netflix Racially Personalizing Artwork for Its Titles?

This story is for Medium members.Continue with FacebookContinue with GoogleMedium curates expert stories from leading publishers exclusively for members (w

Artwork Personalization at Netflix

Artwork Personalization at NetflixFor many years, the main goal of the Netflix personalized recommendation system has been to get the right titles in front

CSU 2019: Fleecing the Raffle 2020: Card Hand Sorting 2022: Artwork 2023: Bless You Autocorrect!

#include<iostream> using namespace std; int main(void) { long long n,p ; while(cin>&

Artwork with Deep Learning

Deep Learning helps in extracting the features of the image(s). Features include the image context and its style. How about extracting the context of

csuoj2022-Artwork(並查集連通塊)

Description  點選開啟題目連結A template for an artwork is a white grid of n × m squares. The artwork will be created by painting q horizontal and