uva 10137 The trip

/*The trip注意特殊資料的處理,誤差不超過0.01即可。*/#include<iostream>#include<cstdio>using namespace std;double a[1005];int main(){ // freopen("./pcio/110103.inp","r",stdin); int n,i; while(~scanf("%d",&n)) { if(n==0)

uva 706 LC-Display

/* LC-Display 蛋疼的類比題 注意輸出的特殊行,如第1行、第2到s+2行、 第s+3到2*s+2行、第2*s+3行,總共有2*s+3行,每一行輸出的大小就可以根據s的大小控制了。 數字最大位元為8位*/#include <iostream>#include <cstring>#include<cstdio>using namespace std;#define MAXLENGTH 8void lcd_display (long size,

hdu–1800–字典樹&&其他

題目串連:http://acm.hdu.edu.cn/showproblem.php?pid=1800 根據題意可知:意思是有若干個飛行員,需要在掃帚上練習飛行,每個飛行員具有不同的等級,且等級高的飛行員可以當等級低的飛行員的老師,且每個飛行員至多有且只有一個老師和學生。具有老師和學生關係的飛行員可以在同一把掃帚上練習,並且這個性質具有傳遞性。即比如有A,B,C,D,E五個飛行員,且等級是A>B>C>D>E,那麼可以使A當B的老師,B當C的老師,E當D的老師,那麼A,B,

NYOJ–68–三點順序

三點順序時間限制:1000 ms  |  記憶體限制:65535 KB難度:3描述 現在給你不共線的三個點A,B,C的座標,它們一定能組成一個三角形,現在讓你判斷A,B,C是順時針給出的還是逆時針給出的?如:圖1:順時針給出圖2:逆時針給出          <圖1>                   <圖2>輸入 每行是一組測試資料,有6個整數x1,y1,x2,y2,x3,y3分別表示A,B,C三個點的橫縱座標。(座標值都在0到10000之間)輸入0 0 0 0 0

NYOJ–72–Financial Management

Financial Management時間限制:3000 ms  |  記憶體限制:65535 KB難度:1描述 Larry graduated this year and finally has a job. He's making a lot of money, but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio

hdu–1075–(字典樹一般)

What Are You Talking AboutTime Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others)Total Submission(s): 10424    Accepted Submission(s): 3320Problem DescriptionIgnatius is so lucky that he met a Martian yesterday. But he

HDU-1166-敵兵布陣(樹狀數組)

HDU-1166-敵兵布陣(樹狀數組)http://acm.hdu.edu.cn/showproblem.php?pid=1166這題之前用線段樹做的,現在用樹狀數組先簡單說下樹狀數組吧如所示c1 = a1c2 = a1 + a2c3 = a3c4 = a1 + a2 + a3 + a4c5 = a5c6 = a5 + a6c7 = a7c8 = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8對於序列a,我們設一個數組C定義C[i] = a[i – 2^k + 1]

hdu–1272–並查集(捏個捏個)

小希的迷宮Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 19668    Accepted Submission(s): 6014Problem Description上次Gardon的迷宮城堡小希玩了很久(見Problem

NYOJ-234-DP(吃馬鈴薯)

吃馬鈴薯時間限制:1000 ms  |  記憶體限制:65535 KB難度:4描述 Bean-eating is an interesting game, everyone owns an M*N matrix, which is filled with different qualities beans. Meantime, there is only one bean in any 1*1 grid. Now you want to eat the beans and collect

codeforce #163 div2

//cf #163 div 2 A// http://codeforces.com/contest/266/problem/A#include<stdio.h>#include<iostream>using namespace std;char a[55];int main(){ int n,i; //freopen("input.txt","r",stdin); while(scanf("%d%*c",&n)!=EOF){ int

STL—set和multiset

#include <iostream>#include <set>using namespace std;int main(){ set<int>set1; for(int i=9; i>0; i--) set1.insert(i); //有序插入 set1.erase(3); for(set<int>::iterator p=set1.begin(); p!=set1.end(); ++p)

最長公用子序列LCS

時間限制:1 秒 空間限制:65536 KB 分值: 0給出兩個字串A B,求A與B的最長公用子序列(子序列不要求是連續的)。比如兩個串為:abcicbaabdkscabab是兩個串的子序列,abc也是,abca也是,其中abca是這兩個字串最長的子序列。Input第1行:字串A第2行:字串B(A,B的長度 <= 1000)Output輸出最長的子序列,如果有多個,隨意輸出1個。Input 樣本abcicbaabdkscabOutput

hdu–1247–Hat’s Words(一般)

Hat’s WordsTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5772    Accepted Submission(s): 2154Problem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly

hdu–1231–最長子序列(DP)

最大連續子序列Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15620    Accepted Submission(s): 6842Problem Description給定K個整數的序列{ N1, N2, ..., NK },其任意連續子序列可表示為{ Ni, Ni+1, ...,Nj },其中 1 <= i <= j

codeforces #165 div2

// div2 A#include <stdio.h>int main(){ int i,j,n,T; scanf("%d",&T); while(T--){ scanf("%d",&n); if(n>=180||n<=0){ printf("NO\n"); continue; } if (360%(180-n)==0)

歸併排序 MergeSort

逆序對數 時間限制:1 秒 空間限制:65536 KB 在一個排列中,如果一對數的前後位置與大小順序相反,即前面的數大於後面的數,那麼它們就稱為一個逆序。一個排列中逆序的總數就稱為這個排列的逆序數。如2 4 3 1中,2 1,4 3,4 1,3 1是逆序,逆序數是4。給出一個整數序列,求該序列的逆序數。Input第1行:N,N為序列的長度(n <= 50000)第2 - N + 1行:序列中的元素(0 <= A[i] <= 10^9)Output輸出逆序數Input 樣本 42

HDU-1160-FatMouse’s Speed

HDU-1160-FatMouse's Speedhttp://acm.hdu.edu.cn/showproblem.php?pid=1160對體重從小到大排序,要求體重越小,速度越快,找一個最長遞增子序列即可#include<stdio.h>#include<string.h>#include<stdlib.h>struct cam{int x;int y;int num;}list[1005];int dp[1005],pre[1005];int cmp(

最大子段和-分治&&動態規劃

     N個整數組成的序列a[1],a[2],a[3],…,a[n],求該序列如a[i]+a[i+1]+…+a[j]的連續子段和的最大值。當所給的整數均為負數時和為0。例如:-2,11,-4,13,-5,-2,和最大的子段為:11,-4,13。和為20。Input第1行:整數序列的長度N(2 <= N <= 50000)第2 - N + 1行:N個整數(-10^9 <= A[i] <= 10^9)Output輸出最大子段和。Input

HDU Humble Numbers

            Humble Numbers   Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Problem DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12,

codeforces #164 div2

http://codeforces.com/problemset/problem/268/Ahttp://codeforces.com/problemset/problem/268/Bhttp://codeforces.com/problemset/problem/268/C// cf #164 div2 A #include<stdio.h>int a[30],b[30];int main(){ //freopen("input.txt","r",stdin); //

總頁數: 61357 1 .... 7797 7798 7799 7800 7801 .... 61357 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.