2012年8月21日

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... 阅读(145) 评论(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)

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)

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)

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)

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)

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... 阅读(139) 评论(0) 推荐(0)