ACM ACM International Collegiate Programming Contest ACMICPC ACMICPC
- Slides: 43
ACM國際大學生程式設計競賽 ACM International Collegiate Programming Contest (ACM-ICPC)
ACM-ICPC l國際大學院校之年度程式設計競賽 l總部設於Baylor University,由電 腦協會(Association for Computing Machinery, ACM) 及IBM公司贊助
台灣地區比賽 l 第 34 屆ACM 國際大學生程式設計競賽 亞洲區 新竹站 l 2009 the 34 th Annual ACM International Collegiate Programming Contest Asia Regional – Hsinchu Site l 國立交通大學主辦 l 競賽活動日期 l 2009 年10 月30~11月1 日
2010 Final l The 34 th ACM International Collegiate Programming Contest World Finals l Harbin, China, February 1 -6, 2010
Tips l 多透過Online Judge練習作題目 ¡ Universidad de Valladolid Online Judge ¡ Ural State University Online Judge ¡ Tianjin University Online Judge ¡ Saratov State University Online Judge ¡ Sphere Online Judge ¡ ACM-ICPC Live Archive Around the World ¡ MIPT Online Judge ¡ Peking University Online Judge ¡ Zhejiang University Online Judge ¡ Harbin Institute of Technology Online Judge ¡ Fuzhou University Online Judge ¡ Online Problems Solving System
Tips l 熟悉比賽作業系統: ¡ 台灣區競賽使用的作業系統為 GNU/Linux SUSE Enterprise for desktop 10 ¡ World Final使用的作業系統為Fedora Core 4 Linux l 熟悉比賽使用語言及發展 具環境: ¡ 台灣區競賽使用的語言為 GNU C/C++ ;程式發展 具: Eclipse ¡ World Final使用的語言為 Java (version 1. 5)、C/C++ (GCC 4. 0)、 Pascal ;程式發展 具: Java - Eclipse 3. 1、C/C++ - CDT 3. 0 under Eclipse 3. 1、Pascal Borland Kylix Version 3. 0 l 熟悉比賽使用裁判程式: ¡ PC 2 (Programming Contest Control System)
Tips l 多準備(寫好)常用的函式或多使用C++ Standard Template Library ¡E. G. #include <stl. h> stack<int> S; queue<char> Q; priority_queue<int> PQ; ¡stack - S. push(), S. top(), S. pop(), S. empty() l You should always top on pop because top returns but does not remove the element on top, while pop removes but does not return the element. l Linked implementations ensure the stack will never be full. ¡queue – Q. front(), Q. back(), Q. push(), Q. pop(), and Q. empty() ¡hash_map – H. erase(), H. find(), H. insert() ¡priority_queue – PQ. push(), PQ. top(), PQ. pop(), PQ. empty() ¡set – S. set_union, S. set_intersection ¡sort or stable_sort
ACM 10041 Vito’s family
題目: l. Background l The world-known gangster Vito Deadstone is moving to New York. He has a very big family there, all of them living in Lamafia Avenue. Since he will visit all his relatives very often, he is trying to find a house close to them. l. Problem l Vito wants to minimize the total distance to all of them and has blackmailed you to write a program that solves his problem.
Input & output l Input l The input consists of several test cases. The first line contains the number of test cases. For each test case you will be given the integer number of relatives r ( 0 < r < 500) and the street numbers (also integers) where they live ( 0 < si < 30000 ). Note that several relatives could live in the same street number. l Output l For each test case your program must write the minimal sum of distances from the optimal Vito's house to each one of his relatives. The distance between two street numbers si and sj is dij= |si-sj|.
Sample input & output l. Sample Input l 2 224 3246 l. Sample Output l 2 4
中文Java程式碼 l import java. util. *; l class Vito { l static int[] 門牌=new int[500]; l static Scanner 輸入 = new Scanner(System. in); l public static void main(String[] 參數) { l int 狀況數 = 輸入. next. Int(); l for(int i=1; i<=狀況數; ++i) l System. out. println(處理狀況並回傳答案()); l } //方法: main() 定義區塊結束 l static long 處理狀況並回傳答案() { l long 總距離=0; l int 最佳門牌; l int 人數 = 輸入. next. Int(); l for (int i=0; i<人數; ++i) l 門牌[i]= 輸入. next. Int(); l
Java程式碼 l import java. util. Scanner; l /*When you submit your program to UVa Judge, you have to change the class name to be Main. And use only variables in English. Or you will get compilation error */ l class Vito 2 {//change the calss name to be Main. Or you will get runtime error l static int[] Address=new int[500]; l static Scanner input = new Scanner(System. in); l public static void main(String[] args) { l int cases = input. next. Int(); l for(int i=1; i<=cases; ++i) l System. out. println(process()); l } //方法: main() 定義區塊結束 l static long process() { l long total. D=0; l int best. Address; l int people = input. next. Int(); l for (int i=0; i<people; ++i) l Address[i]= input. next. Int();
Java程式碼 l for (int i=people-1; i>=1; --i) l for (int j=0; j<=i-1; ++j) l if(Address[j]>Address[j+1]) { l int t=Address[j]; l Address[j]=Address[j+1]; l Address[j+1]=t; l } l best. Address=Address[people/2]; l for (int i=0; i<people; ++i) l total. D+=Math. abs(Address[i]-best. Address); l return total. D; l } //方法: process() 定義區塊結束 l } //類別: Vito 2 定義區塊結束
C++程式碼 l #include "iostream. h" l #include "math. h" l int door[500]; l long int process(); l int main() { l int cases; l cin>>cases; l for(int i=1; i<=cases; ++i) l cout<<process()<<endl; l return 0; l } //方法: main() 定義區塊結束 l long int process() { l long int total=0; l int best; l int people; l cin>>people; l for (int i=0; i<people; ++i) l cin>>door[i];
C++程式碼 l for (int i=people-1; i>=1; --i) l for (int j=0; j<=i-1; ++j) l if(door[j]>door[j+1]) { l int t=door[j]; l door[j]=door[j+1]; l door[j+1]=t; l } l best=door[people/2]; l for (int i=0; i<people; ++i) l total+=(long int)fabs(door[i]-best); l return total; l } //方法: process() 定義區塊結束
- Acmicpc
- Icbsc
- 2018 virginia tech high school programming contest
- Virginia tech high school programming contest
- Icpc north america problems
- Presentation error uva
- International filter photo contest
- International speech contest topics
- Acm international academy
- Grand prairie collegiate institute
- Mealy mountain collegiate
- Korah collegiate
- Middlefield collegiate institute
- Education in venezuela
- Ama collegiate conference
- Lennard high school football
- Phoenix collegiate uniform
- Evaluator s5 ht
- Lennard collegiate academy
- Perbedaan linear programming dan integer programming
- Greedy vs dynamic programming
- What is system programing
- Linear vs integer programming
- Definisi linear
- "leads international" "international marketing"
- "leads international" "international marketing"
- Young authors contest 2022 howard county
- Yankee clipper contest club
- Tlups
- Teknis lomba spelling bee
- Toastmasters table topics contest questions
- Contest management system
- Michigan ffa skills contest
- Contest at mount carmel
- Anthem essay contest examples
- Wiznet contest
- Tropical grapefruit moscato
- Criteria for judging art
- Ideas for yammer posts
- Keynes beauty contest
- The contest among sellers to win customers is known as
- Oral reading contest
- Dubus eme contest 2021
- Sales contest themes