poj Dual Core CPU,pojdualcorecpu

來源:互聯網
上載者:User

poj Dual Core CPU,pojdualcorecpu

                              Dual Core CPU

 

題目:

   給出由核A和核B組成的雙核CPU上的運行N個模組。模組i在核A上執行的花費為Ai,在核B上執行的花費為Bi。有M個互相之間需要進行資料交換的模組組合(ai,bi),如果,這兩塊模組在同一個核上執行則沒有額外的費用,否則會產生wi的花費。請計算執行所有模組所需的最小花費。

 

演算法分析:

   用最小的費用將對象劃分成兩個集合問題,常常可以轉換最小割後順利解決。

   這道題目就是這類問題的一個經典例子。考慮把N個模組按照在哪個核上運行分成兩個集合。

   然後,就是建圖問題了。因為,我們把兩個核分成了兩個集合,所以我們可以分別對在同一個核上啟動並執行模組跟源或者匯串連。比如,Ai跟T串連,則Bi跟S串連,而轉換核需要的話費就是對這兩個模組分別串連一個花費為Wi的邊就可以了。最後求解最小割就是答案了。

 

#include <iostream>#include <algorithm>#include <vector>#include <queue>#include <cstdio>#include <cstring>using namespace std;const int MAXN = 20000 + 10;const int INF = 1 << 30;struct Edge{    int from,to,cap,flow;    Edge(){};    Edge(int _from,int _to,int _cap,int _flow)        :from(_from),to(_to),cap(_cap),flow(_flow){};};vector<Edge> edges;vector<int> G[MAXN];int cur[MAXN],d[MAXN];bool vst[MAXN];int N,M,S,T;void init(){    S = N + 1; T = N + 2;    for(int i = 0;i <= T;++i)        G[i].clear();    edges.clear();}void addEdge(int from,int to,int cap){    edges.push_back(Edge(from,to,cap,0));    edges.push_back(Edge(to,from,0,0));    int sz = edges.size();    G[from].push_back(sz - 2);    G[to].push_back(sz - 1);}bool BFS(){    queue<int> Q;    memset(vst,0,sizeof(vst));    Q.push(S);    vst[S] = 1;    d[S] = 0;    while(!Q.empty()){        int u = Q.front(); Q.pop();        for(int i = 0;i < (int)G[u].size();++i){            Edge& e = edges[G[u][i]];            if(!vst[e.to] && e.cap > e.flow){                d[e.to] = d[u] + 1;                vst[e.to] = 1;                Q.push(e.to);            }        }    }    return vst[T];}int DFS(int x,int a){    if(x == T|| a == 0)        return a;    int flow = 0,f;    for(int& i = cur[x];i < (int)G[x].size();++i){        Edge& e = edges[G[x][i]];        if(d[e.to] == d[x] + 1 && (f = DFS(e.to,min(a,e.cap - e.flow))) > 0){            e.flow += f;            edges[G[x][i]^1].flow -= f;            flow += f;            a -= f;            if(a == 0) break;        }    }    return flow;}int maxFlow(){   int flow = 0;   while(BFS()){       memset(cur,0,sizeof(cur));       flow += DFS(S,INF);   }   return flow;}int main(){//    freopen("Input.txt","r",stdin);    while(~scanf("%d%d",&N,&M)){        init();        int a,b,w;        for(int i = 1; i <= N;++i){            scanf("%d%d",&a,&b);            addEdge(i,T,a);            addEdge(S,i,b);        }        for(int i = 0;i < M;++i){            scanf("%d%d%d",&a,&b,&w);            addEdge(a,b,w);                //是雙向的,注意!!!!!!!!!!            addEdge(b,a,w);        }        printf("%d\n",maxFlow());    }    return 0;}


 


CPU型號為Dual-Core ARMv7 Procesor的CPU怎

這是COrtex-a7架構的ARM CPU 此手機採用 高通 驍龍Snapdragon MSM8225 雙核處理器 @ 1.0GHz
 
Cpu裡面的,dual,core這2個都代表什意思

dual 雙的,形容詞
core 核心,名詞

dual core cpu 就是雙核心CPU
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.