08 2012 档案
uva 工具网站 顶 顶!!!
摘要:UVa Online Judge工具網站 转自http://www.csie.ntnu.edu.tw/~u91029/uva.htmlLucky貓的ACM園地,Lucky貓的 ACM 中譯題目 Mirror這個站專門提供UVa Online Judge中譯題目。非常棒!非常棒!非常棒!我在搜尋引擎輸入過上百次的Luckycat!UVa Online Judge: Electronic BoardUVa Online Judge的問題討論版。由於主頁上沒有放連結,所以可能有人不知道。發問時請遵守板規,善用搜尋功能,找到問題的討論串,發問時採用回覆文章方式。讓後人可以容易找到相關討論。UVA to 阅读全文
posted @ 2012-08-25 09:33 Primo... 阅读(201) 评论(0) 推荐(0)
uva10050-罢工
摘要:#include #include using namespace std; int main () { int a[4000], count, b, t, n, p; cin>>t; while(t--) { count = 0; memset(a,0,sizeof(a)); cin>>n>>p; for(int i = 0; i >b; for(int j = b; j <= n; j+=b) a[j] = 1; } ... 阅读全文
posted @ 2012-08-24 13:31 Primo... 阅读(131) 评论(0) 推荐(0)
UVA11111-一般Matrioshka
摘要:这个题开始的时候是一点思路也没有,后来按照自己不成熟的思路写,总是写了删,删了再写。浪费时间不说,还大大打击了我的自信心。后来想到了递归,比较符合这个题的思路。每个玩偶用一个递归中的一步来表示,层层递进,正好符合题意说的玩偶层层相包,思路酝酿成熟了,再写代码,就比较顺手。但是我还是wa了一遍。我把这个题想的太简单了。考虑的不全面,例如:每行输入可以包含多个最大的玩偶的情况我就给忽略了测试样例为-9 -7 7 -9 9 -9 :::结果是“:-) Matrioshka!”;代码如下:#include using namespace std; int flag2; int stack (in... 阅读全文
posted @ 2012-08-23 14:00 Primo... 阅读(153) 评论(0) 推荐(0)
hdu4119-Isabella's Message
摘要:这个题是我水出来的,水了一天才水出来的,代码有点乱。思路:1,读矩阵,2,从不同方向四种翻转,每种翻转翻三个90°3,读入m个单词4,找出不合要求的情况做好标记5,输出字典序最小的 明文代码如下:(由于变量很多,命名命的我头都大了,所以有点乱)#include #include #include #include using namespace std; const int N = 55; char a[N][N], b[N][N]; string word[4][105]; string s[4], s2[105]; void trans (int n) { char c[... 阅读全文
posted @ 2012-08-21 13:43 Primo... 阅读(144) 评论(0) 推荐(0)
UVA10115-自动编辑
摘要:01.#include 02.#include 03. 04.using namespace std; 05. 06.int main () 07.{ 08. int n; 09. while(cin>>n&&n) 10. { 11. cin.get(); 12. string s[n],t[n]; 13. for(int i = 0; i "<<t[j]<<endl; 38. st.replace(i,l,t[j]); 39. ... 阅读全文
posted @ 2012-08-21 10:24 Primo... 阅读(158) 评论(0) 推荐(0)
URAL1102
摘要:此题最佳算法是倒着做,正着做太麻烦,反例inputon,倒着做更好做一些,01.#include 02.#include 03.using namespace std; 04.int main () 05.{ 06. int n; 07. cin>>n; 08. while(n) 09. { 10. string s; 11. cin>>s; 12. int flag = 1; 13. for(int i = (int)s.size()-1; flag&&i >=0 ; i--) ... 阅读全文
posted @ 2012-08-21 10:23 Primo... 阅读(132) 评论(0) 推荐(0)
UVA575-斜二进制
摘要:#include #include #include using namespace std;int main (){ string s; while(getline(cin,s)) { if(s.size()== 1&&s[0] == '0')break; long long int sum = 0; for(int i = s.size()-1; i >= 0; i--) { sum+=(s[i]-'0')*(pow(2,s.size()-i)-1); } cout<... 阅读全文
posted @ 2012-08-21 10:22 Primo... 阅读(133) 评论(0) 推荐(0)
UVA579-时钟的指示
摘要:#include #include using namespace std;int main (){ int h, m; double a1, a2,angle; char c; while(cin>>h>>c>>m) { if(!h&&!m)break; if(h==12)h = 0; a1 = (h+m/60.0)*30.0; a2 = m*6.0; angle = a2 - a1; //cout"; ... 阅读全文
posted @ 2012-08-21 10:21 Primo... 阅读(99) 评论(0) 推荐(0)
UVA591-一盒砖
摘要:#include using namespace std;int main (){ int n; int count = 0; while(cin>>n) { count++; if(!n)break; int a[n]; int sum = 0; for(int i = 0; i >a[i]; sum+=a[i]; } sum/=n; int min = 0; for(int i = 0; i sum) ... 阅读全文
posted @ 2012-08-21 10:21 Primo... 阅读(106) 评论(0) 推荐(0)
UVA621-秘密研究
摘要:#include #include using namespace std;int main (){// string a[3] = {"135","435","7835"};// string b[3] = {"914","944","9784"};// string c[3] = {"1901","1904","19078"};// string d[3] = {"1","4&quo 阅读全文
posted @ 2012-08-21 10:21 Primo... 阅读(114) 评论(0) 推荐(0)
UVA755- 487-3279
摘要:对于这个题,花费的时间也不少。错误一;由于考虑不全1400U--4N712---X2-KN-U-75VR-J37G--385W-0Y6-V85W-0Y6-V85W-0Y6-V--N-6AV4-NK--XL----F-PO--B-0-P-10167P7--R8YME-NP-U-1O6W-----1X-KFK87--LYFX63K-N-3-73G---ELH--2RD-6-IJ-YP2--SJ9G9P2--SJ9G9O-1----2287-2-DC-C1L-3V7963V68U-66X52MU-66X52M-8-16F5TG---YN-32E5-K---YN-32E5-K4--KDJ-PV24-- 阅读全文
posted @ 2012-08-21 10:21 Primo... 阅读(168) 评论(0) 推荐(0)
UVA673-括号平衡
摘要:#include #include using namespace std;struct point{ char ch; point *next;};int main (){ int n, len, flag = 0, flag2 = 0; string s; cin>>n; cin.get(); while(n--) { point *p, *q, *head, *bridge; getline(cin,s); if(!s.size()) { coutch = s[i... 阅读全文
posted @ 2012-08-21 10:21 Primo... 阅读(114) 评论(0) 推荐(0)
UVA644-立即可解码性
摘要:#include #include #include using namespace std;int com(const void *a , const void *b){ return strlen(((char *)a))- strlen(((char *)b));}int main (){ char b[9][15]; char c; int num = 0; while(1) { int i = 0, j = 0; num++; while(c = cin.get()) { ... 阅读全文
posted @ 2012-08-21 10:21 Primo... 阅读(108) 评论(0) 推荐(0)
UVA1122-clock
摘要:此题的难点是表盘的规律,时针和分针相遇的时刻是60*hour/11,还有,常疏忽的地方是第一行和最后一行的两句话、#include #include using namespace std;int main (){ cout>a>>b>>c>>d) { int n = c - a; if(n==0&&d<b) n+=11; if(n<0)n += 11; n += 13; if(((60*(a)/11))<b)n -= 1; if(c==12)n-=1; else if(d<((60*... 阅读全文
posted @ 2012-08-21 10:20 Primo... 阅读(137) 评论(0) 推荐(0)
UVA846-步数
摘要:#include using namespace std;int main (){ int m, n; int num; cin>>num; while(num--) { cin>>m>>n; int dis, step = 0; dis = n - m; if(dis == 0) { cout<<0<<endl; continue; } int k = 0; for(k = 0; k*k <= dis; k+... 阅读全文
posted @ 2012-08-21 10:20 Primo... 阅读(96) 评论(0) 推荐(0)