第一题:401 - Palindromes

UVA : http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=96&page=show_problem&problem=342

解题思路:此题很水,只要把 mirrored string 类的对应关系搞对,基本就可以了! 但是细节要注意,首先只有一个元素的时候需要单独判断,一个字符是回文串,是不是 mirrored string 则需要判断,另外最后输出中间隔了一行!

解题代码:

  1. // File Name: 刘汝佳-基础/part2/Palindromes/401.cpp
  2. // Author: sheng
  3. // Created Time: 2013年07月20日 星期六 23时37分45秒
  4. #include <iostream>
  5. #include <stdio.h>
  6. #include <string.h>
  7. using namespace std;
  8. const int max_n = ;
  9. const int max_f = ;
  10. int main ()
  11. {
  12. bool mir[max_f][max_f];
  13. char ch[max_n];
  14. memset (mir, false, sizeof (mir));
  15. mir['A']['A'] = true;
  16. mir['E'][''] = mir['']['E'] = true;
  17. mir['H']['H'] = true;
  18. mir['I']['I'] = ;
  19. mir['J']['L'] = mir['L']['J'] = ;
  20. mir['M']['M'] = ;
  21. mir['O']['O'] = ;
  22. mir['S'][''] = mir['']['S'] = ;
  23. for (int i = 'T'; i <= 'Y'; i ++)
  24. mir[i][i] = ;
  25. mir['Z'][''] = mir['']['Z'] = ;
  26. mir[''][''] = ;
  27. mir[''][''] = ;
  28. while (~scanf ("%s", ch))
  29. {
  30. bool ms = true, ps = true;
  31. int len = strlen (ch);
  32. // cout << len << endl;
  33. if (len == && (!mir[ch[]][ch[]]))
  34. ms = false;
  35. for (int i = ; i < len/; i ++)
  36. {
  37. if ( ch[i] != ch[len--i] )
  38. ps = false;
  39. if (!mir[ch[i]][ch[len--i]])
  40. ms = false;
  41. if ((!ms) && (!ps))
  42. break;
  43. }
  44. if (ms && ps)
  45. cout << ch << " -- is a mirrored palindrome.\n\n";
  46. else if (ms)
  47. cout << ch << " -- is a mirrored string.\n\n";
  48. else if (ps)
  49. cout << ch << " -- is a regular palindrome.\n\n";
  50. else cout << ch << " -- is not a palindrome.\n\n";
  51. }
  52. return ;
  53. }

第二题:10010 - Where's Waldorf?

UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=951

解题思路:因为数据范围很小所以可以暴力搜索,总共八个方向,只要有一个方向可以组成当前单词就标记此开始点并跳出,寻找下一个单词!

水题一道,却花了一下午的时间,英语差是一方面,最不该就是使用了goto,害得程序陷入死循环,而我却在没有bug的地方找死循环的原因找了一下午,哎!还需使劲练习啊!

解题代码:

  1. // File Name :刘汝佳-基础/part2/10010 - Where's Waldorf?
  2. // Author :Freetion
  3. // Created Time :2013年07月22日 星期一 14时32分18秒
  4. #include <string.h>
  5. #include <stdio.h>
  6. char map[][];
  7. bool tag[][];
  8. int T;
  9. int n, m, k, q;
  10. char ser[][];
  11. int len;
  12. struct CUN
  13. {
  14. int x, y;
  15. }cun[];
  16. const int alt_x[] = {-, -, , , , , -, };
  17. const int alt_y[] = {-, , -, , -, , , };
  18. int serch(int x, int y, int l)
  19. {
  20. for (int i = ; i < ; i ++)//八个方向
  21. {
  22. int xx = x + alt_x[i];
  23. int yy = y + alt_y[i];
  24. l = ;
  25. while (l < len && xx > && xx <= n && yy > && yy <= m)//向一个方向找
  26. {
  27. int temp_x = xx + alt_x[i];
  28. int temp_y = yy + alt_y[i];
  29. if (ser[q][l] == map[xx][yy])
  30. {
  31. l ++;
  32. xx = temp_x;
  33. yy = temp_y;
  34. }
  35. else break;
  36. }
  37. if (l == len)
  38. return ;//找到返回1
  39. }
  40. return ;//没有返回0
  41. }
  42. void init()
  43. {
  44. for (int i = ; i <= n; i ++)
  45. {
  46. for (int j = ; j <= m; j ++)
  47. {
  48. char ch;
  49. scanf ("%c", &ch);
  50. if (ch <= 'Z')
  51. ch = ch - 'A' + 'a';
  52. map[i][j] = ch;
  53. }
  54. map[i][m+] = '\0';
  55. getchar();
  56. }
  57. /*
  58. for (int i = 1; i <= n; i++)
  59. {
  60. for (int j = 1; j <= m; j ++)
  61. printf("%c", map[i][j]);
  62. printf("\n");
  63. }
  64. */
  65. scanf ("%d", &k);
  66. getchar();
  67. int len;
  68. char ch[];
  69. for (int i = ; i <= k; i ++)
  70. {
  71. scanf ("%s", ch);
  72. len = strlen(ch);
  73. for (int j = ; j < len; j ++)
  74. {
  75. if (ch[j] <= 'Z')
  76. ch[j] = ch[j] - 'A' + 'a';
  77. }
  78. strcpy(ser[i], ch);
  79. ser[i][len] = '\0';
  80. }
  81. /*
  82. for (int i = 1; i <= k; i ++)
  83. printf("len = %d %s\n", strlen(ser[i]), ser[i]);
  84. */
  85. }
  86. int main ()
  87. {
  88. scanf ("%d", &T);
  89. while (T--)
  90. {
  91. scanf ("%d%d", &n, &m);
  92. getchar();
  93. init();
  94. for (q = ; q <= k; q ++)//就是在这里使用了goto导致q一直为1
  95. {
  96. int tag = ;
  97. len = strlen(ser[q]);
  98. char ch = ser[q][];
  99. for (int i = ; i <= n; i ++)
  100. {
  101. for (int j = ; j <= m; j ++)
  102. {
  103. if (ch == map[i][j])
  104. if (serch(i, j, ))
  105. {
  106. cun[q] = (CUN){i, j};
  107. tag = ;
  108. }
  109. if (tag)
  110. break;
  111. }
  112. if (tag)
  113. break;
  114. }
  115. }
  116. for (int i = ; i <= k; i ++)
  117. printf ("%d %d\n", cun[i].x, cun[i].y);
  118. if (T)
  119. printf ("\n");
  120. }
  121. return ;
  122. }

第三题:10361 - Automatic Poetry

UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1302

解题思路:水题一道!

解题代码:

  1. // File Name :刘汝佳-基础/part2/10361 - Automatic Poetry
  2. // Author :Freetion
  3. // Created Time :2013年07月22日 星期一 20时10分53秒
  4. #include <stdio.h>
  5. #include <string>
  6. #include <string.h>
  7. #include <iostream>
  8. //#define LOCAL
  9. using namespace std;
  10. const int max_l = ;
  11. char str1[max_l], str2[max_l], str3[max_l], str4[max_l], str5[max_l], str6[max_l];
  12. int main()
  13. {
  14. #ifdef LOCAL
  15. freopen("data.in", "r", stdin);
  16. freopen("data.out", "w", stdout);
  17. #endif
  18. int n, num1, num2, num3, num4;
  19. while (~scanf("%d", &n))
  20. {
  21. getchar();
  22. for (int i = ; i < n; i ++)
  23. {
  24. gets(str1);
  25. gets(str2);
  26. int len1 = strlen(str1);
  27. int tag = ;
  28. num1 = num2 = num3 = num4 = ;
  29. for (int j = ; j < len1; j ++)
  30. {
  31. if (str1[j] != '<' && str1[j] != '>')
  32. printf ("%c", str1[j]);
  33. else if (str1[j] == '<')
  34. tag ++;
  35. else if (str1[j] == '>')
  36. tag ++;
  37. if (tag == )
  38. str3[num1++] = str1[j];
  39. else if (tag == )
  40. str5[num3++] = str1[j];
  41. else if (tag == )
  42. str4[num2++] = str1[j];
  43. else if (tag == )
  44. str6[num4++] = str1[j];
  45. }
  46. printf("\n");
  47. int len2 = strlen(str2);
  48. for (int j = ; j < len2-; j ++)
  49. printf ("%c", str2[j]);
  50. for (int j = ; j < num2; j ++)
  51. printf("%c", str4[j]);
  52. for (int j = ; j < num3; j ++)
  53. printf ("%c", str5[j]);
  54. for (int j = ; j < num1; j ++)
  55. printf ("%c", str3[j]);
  56. for (int j = ; j < num4; j ++)
  57. printf ("%c", str6[j]);
  58. printf ("\n");
  59. }
  60. }
  61. return ;
  62. }

第四题:537 - Artificial Intelligence?

UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=478

解题思路:按关键字将数据提取出来即可,水题!还有,输出是每个案列后都会有一个空行,这里wa三次! UVA为什么没有PE呢?

解题代码:好吧,可能太长,有点凌乱!

  1. // File Name :刘汝佳-基础/part2/537 - Artificial Intelligence?
  2. // Author :Freetion
  3. // Created Time :2013年07月22日 星期一 22时25分10秒
  4. #include <stdio.h>
  5. #include <string.h>
  6. const int max_l = ;
  7. char phy[max_l];
  8. int main()
  9. {
  10. int t, T;
  11. scanf ("%d", &t);
  12. T = t;
  13. getchar();
  14. double U, I, P;
  15. int tag_u = , tag_i = , tag_p = ;
  16. while(t--)
  17. {
  18. gets(phy);
  19. int len = strlen(phy);
  20. U = I = P = ;
  21. for (int i = ; i < len; i ++)
  22. {
  23. if (phy[i] == 'U' && phy[++i] == '=')
  24. {
  25. tag_u = ;
  26. int tag = ;
  27. int tm;
  28. i ++;
  29. while(phy[i] == '.' || (phy[i] >= '' && phy[i] <= ''))
  30. {
  31. if (phy[i] == '.')
  32. {
  33. tm = ;
  34. tag = ;
  35. i ++;
  36. }
  37. if (tag)
  38. U = U* + phy[i] - '';
  39. else
  40. {
  41. U = U + (phy[i] - '')*1.0/tm;
  42. tm *= ;
  43. }
  44. i ++;
  45. }
  46. if (phy[i] == 'm')
  47. U = U/;
  48. else if (phy[i] == 'k')
  49. U = U*;
  50. else if (phy[i] == 'M')
  51. U = U**;
  52. }
  53. if (phy[i] == 'I' && phy[++i] == '=')
  54. {
  55. tag_i = ;
  56. int tag = ;
  57. int tm;
  58. i ++;
  59. while(phy[i] == '.' || (phy[i] >= '' && phy[i] <= ''))
  60. {
  61. if (phy[i] == '.')
  62. {
  63. tm = ;
  64. tag = ;
  65. i ++;
  66. }
  67. if (tag)
  68. I = I* + phy[i] - '';
  69. else
  70. {
  71. I = I + (phy[i] - '')*1.0/tm;
  72. tm *= ;
  73. }
  74. i ++;
  75. }
  76. if (phy[i] == 'm')
  77. I = I/;
  78. else if (phy[i] == 'k')
  79. I = I*;
  80. else if (phy[i] == 'M')
  81. I = I**;
  82. }
  83. if (phy[i] == 'P' && phy[++i] == '=')
  84. {
  85. tag_p = ;
  86. int tag = ;
  87. int tm;
  88. i ++;
  89. while(phy[i] == '.' || (phy[i] >= '' && phy[i] <= ''))
  90. {
  91. if (phy[i] == '.')
  92. {
  93. tm = ;
  94. tag = ;
  95. i ++;
  96. }
  97. if (tag)
  98. P = P* + phy[i] - '';
  99. else
  100. {
  101. P = P + (phy[i] - '')*1.0/tm;
  102. tm *= ;
  103. }
  104. i ++;
  105. }
  106. if (phy[i] == 'm')
  107. P = P/;
  108. else if (phy[i] == 'k')
  109. P = P*;
  110. else if (phy[i] == 'M')
  111. P = P**;
  112. }
  113. if (tag_p && tag_u)
  114. break;
  115. if (tag_u && tag_i)
  116. break;
  117. if (tag_p && tag_i)
  118. break;
  119. }
  120. printf ("Problem #%d\n", T - t);
  121. if (tag_u && tag_i)
  122. {
  123. tag_u = tag_i = ;
  124. printf ("P=%.2fW\n", U*I);
  125. }
  126. else if (tag_u && tag_p)
  127. {
  128. tag_u = tag_p = ;
  129. printf("I=%.2fA\n", P/U);
  130. }
  131. else
  132. {
  133. printf("U=%.2fV\n", P/I);
  134. tag_i = tag_p = ;
  135. }
  136. //if (t)
  137. printf ("\n");
  138. }
  139. return ;
  140. }

第五题:409 - Excuses, Excuses!

UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=96&page=show_problem&problem=350

解题思路:暴力搜素即可,但须注意判断条件。

解题代码:

  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <map>
  4. #include <algorithm>
  5. #include <string.h>
  6. using namespace std;
  7. //#define LOCAL
  8. struct SENT
  9. {
  10. int sign, num;
  11. bool operator < (const SENT s) const
  12. {
  13. if (num == s.num)
  14. return sign < s.sign;
  15. return num > s.num;
  16. }
  17. }sen[];
  18. int main()
  19. {
  20. #ifdef LOCAL
  21. freopen("data.in", "r", stdin);
  22. freopen("data.out", "w", stdout);
  23. #endif
  24. char key[][], sent[][];
  25. int n, m, T = ;
  26. while (~scanf("%d%d", &n, &m))
  27. {
  28. getchar();
  29. for (int i = ; i < n; i++)
  30. {
  31. scanf ("%s", key[i]);
  32. getchar();
  33. int len = strlen(key[i]);
  34. for (int j = ; j < len; j ++)
  35. {
  36. if (key[i][j] <= 'Z')
  37. key[i][j] = key[i][j] - 'A' + 'a';
  38. }
  39. }
  40. bool tag[];
  41. for (int i = ; i < m; i ++)
  42. {
  43. memset(tag, true, sizeof(tag));
  44. sen[i].num = ;
  45. sen[i].sign = i;
  46. gets(sent[i]);
  47. // puts(sent[i]);
  48. int len = strlen(sent[i]);
  49. for (int j = ; j < len; j ++)
  50. {
  51. if (j == || ((sent[i][j-] > 'Z' || sent[i][j-] < 'A') && (sent[i][j-] < 'a' || sent[i][j-] > 'z')))
  52. {//不能仅用空格作为判断条件
  53. for (int k = ; k < n; k ++)
  54. {
  55. if ((key[k][] == sent[i][j] || key[k][] == sent[i][j]-'A'+'a') && tag[k])
  56. {
  57. int len_k;
  58. int l;
  59. len_k = strlen(key[k]);
  60. for (l = ; l < len_k; l ++)
  61. {
  62. if (j+l < len && key[k][l] != sent[i][j+l] && key[k][l] != sent[i][j+l]-'A'+'a')
  63. break;
  64. }
  65. if (l == len_k)
  66. {
  67. tag[k] = false;
  68. sen[i].num ++;
  69. j = j+l;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. sort(sen, sen+m);
  77. printf("Excuse Set #%d\n", ++T);
  78. for (int i = ; i < m; i ++)
  79. if (sen[i].num == sen[].num)
  80. puts(sent[sen[i].sign]);
  81. puts("");
  82. }
  83. return ;
  84. }

第六题:10878 - Decode the tape

UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=96&page=show_problem&problem=1819

解题思路:找出输入字符与ASCII码的关系就可输出,这里以output打印出 A 作介绍:对应的字符串:

|   o       .     o |

这里列出打印 A 字符的依据,并标上列数, A 字符的ASCII码值为 65 而 65 = 2(10 - 4) + 2(10 - 10) 所以打印 A字符,其余字符也是如此计算!

解题代码:

  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <math.h>
  4. using namespace std;
  5. //#define LOCAL
  6. int main()
  7. {
  8. #ifdef LOCAL
  9. freopen("data.in", "r", stdin);
  10. freopen("data.out", "w", stdout);
  11. #endif
  12. char ch;
  13. int tag = ;
  14. while ()
  15. {
  16. int s = ;
  17. for (int i = ; i < ; i++)
  18. {
  19. scanf ("%c", &ch);
  20. if (ch == '_')
  21. tag ++;
  22. if (ch == 'o')
  23. {
  24. if (i < )
  25. s += pow(, -i);
  26. else s += pow(, - i);
  27. }
  28. }
  29. getchar();
  30. if (s)
  31. printf("%c", s);
  32. if (tag == )
  33. break;
  34. }
  35. }

第七题:10815 - Andy's First Dictionary

uva:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1756

解题思路:输入字符串,找出所有单词,找过过程中,判断是否保存过,保存过就抛弃,没有则保存,并标记已保存,然后排序输出就可。

解题代码:

  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <math.h>
  4. #include <algorithm>
  5. #include <string.h>
  6. #include <string>
  7. #include <map>
  8. using namespace std;
  9. #define LOCAL
  10. #ifdef WINDOWS
  11. #define LL __int64
  12. #define LLD "%I64d"
  13. #else
  14. #define LL long long
  15. #define LLD "%lld"
  16. #endif
  17. int main()
  18. {
  19. #ifdef LOCAL
  20. freopen("data.in", "r", stdin);
  21. freopen("data.out", "w", stdout);
  22. #endif
  23. map <string, int> word;
  24. string str[], tm1_str, tm2_str;
  25. int cun = ;
  26. while (cin >> tm1_str)
  27. {
  28. int len = tm1_str.length();
  29. for (int i = ; i < len; i ++)
  30. {
  31. tm2_str.clear();
  32. while((tm1_str[i] <= 'Z' && tm1_str[i] >= 'A') || (tm1_str[i] <= 'z' && tm1_str[i] >= 'a'))
  33. {
  34. if (tm1_str[i] <= 'Z')
  35. tm2_str += (tm1_str[i] - 'A' + 'a');
  36. else tm2_str += tm1_str[i];
  37. i ++;
  38. if (i >= len)
  39. break;
  40. }
  41. if (!tm2_str.empty())
  42. {
  43. if (word[tm2_str] == )
  44. {
  45. str[cun++] = tm2_str;
  46. word[tm2_str] = ;
  47. }
  48. }
  49. }
  50. }
  51. sort(str, str+cun);
  52. for (int i = ; i < cun; i ++)
  53. cout << str[i] << endl;
  54. return ;
  55. }

第八题:644 - Immediate Decodability

UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=585

解题思路:先按字典序或字符串长短排个序,然后就挨个找就可以了,字典序也可以是因为比如0000,01后者肯定不是前者的前缀,至于00, 000这一类就需要进行判断!

解题代码:

  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <math.h>
  4. #include <algorithm>
  5. #include <string.h>
  6. #include <string>
  7. #include <map>
  8. using namespace std;
  9. //#define LOCAL //Please annotate this line when you submit
  10. #ifdef WINDOWS
  11. #define LL __int64
  12. #define LLD "%I64d"
  13. #else
  14. #define LL long long
  15. #define LLD "%lld"
  16. #endif
  17. string str, str1[];
  18. map <string, bool> IM;
  19. int solve(int cun)
  20. {
  21. int tag = ;
  22. sort(str1, str1+cun);
  23. for (int i = ; i < cun && tag; i ++)
  24. {
  25. string temp;
  26. temp.clear();
  27. int len = str1[i].length();
  28. for (int j = ; j < len && tag; j ++)
  29. {
  30. temp += str1[i][j];
  31. if (IM[temp])
  32. {
  33. tag = ;
  34. break;
  35. }
  36. }
  37. IM[str1[i]] = ;
  38. str1[i].clear();
  39. }
  40. return tag;
  41. }
  42. int main()
  43. {
  44. #ifdef LOCAL
  45. freopen("data.in", "r", stdin);
  46. freopen("data.out", "w", stdout);
  47. #endif
  48. int T = ;
  49. bool tag = ;
  50. int cun = ;
  51. while (cin>>str)
  52. {
  53. if (str[] == '')
  54. {
  55. tag = solve(cun);
  56. if (tag)
  57. printf("Set %d is immediately decodable\n", ++T);
  58. else printf("Set %d is not immediately decodable\n", ++T);
  59. tag = ;
  60. IM.clear();
  61. cun = ;
  62. }
  63. else
  64. str1[cun ++] = str;
  65. }
  66. return ;
  67. }

第九题:10115 - Automatic Editing

UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1056

解题思路:字符串匹配与替换,水题

解题代码:

  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <math.h>
  4. #include <algorithm>
  5. #include <string.h>
  6. #include <string>
  7. #include <map>
  8. using namespace std;
  9.  
  10. //#define LOCAL //Please annotate this line when you submit
  11.  
  12. #ifdef WINDOWS
  13. #define LL __int64
  14. #define LLD "%I64d"
  15. #else
  16. #define LL long long
  17. #define LLD "%lld"
  18. #endif
  19.  
  20. const int max_n = ;
  21.  
  22. int n;
  23. char rep[max_n][max_n], by[max_n][max_n];
  24. char str[][max_n];
  25.  
  26. int init()
  27. {
  28. if(~scanf ("%d", &n) && n)
  29. {
  30. getchar();
  31. for (int i = ; i < n; i++)
  32. {
  33. gets(rep[i]);
  34. gets(by[i]);
  35. }
  36. gets(str[]);
  37. // puts(str[0]);
  38. return ;
  39. }
  40. return ;
  41. }
  42.  
  43. int solve()
  44. {
  45. int pos = ;
  46. for (int i = ; i < n; i ++)
  47. {
  48. int len = strlen(str[pos]);
  49. for(int j = ; j < len; j ++)
  50. {
  51. if(str[pos][j] == rep[i][])
  52. {
  53. int k;
  54. int tm_len = strlen(rep[i]);
  55. for (k = ; k < tm_len && j+k < len; k ++)
  56. {
  57. if (str[pos][j+k] != rep[i][k])
  58. break;
  59. }
  60. if (tm_len == k)
  61. {
  62. int cun = ;
  63. for (int r = ; r < len; r ++)
  64. {
  65. if (r != j)
  66. str[pos^][cun++] = str[pos][r];
  67. else
  68. {
  69. int by_len = strlen(by[i]);
  70. for(int l = ; l < by_len; l ++)
  71. str[pos^][cun++] = by[i][l];
  72. r = j + tm_len - ;
  73. }
  74. }
  75. str[pos^][cun] = '\0';
  76. j = ;
  77. len = strlen(str[pos^]);
  78. pos ^= ;
  79. }
  80. }
  81. }
  82. }
  83. return pos;
  84. }
  85.  
  86. int main()
  87. {
  88.  
  89. #ifdef LOCAL
  90. freopen("data.in", "r", stdin);
  91. freopen("data.out", "w", stdout);
  92. #endif
  93. while(init())
  94. {
  95. int pos = solve();
  96. puts(str[pos]);
  97. }
  98. return ;
  99. }

刘汝佳 算法竞赛-入门经典 第二部分 算法篇 第五章 1(String)的更多相关文章

  1. 刘汝佳 算法竞赛-入门经典 第二部分 算法篇 第五章 3(Sorting/Searching)

    第一题:340 - Master-Mind Hints UVA:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Item ...

  2. 刘汝佳 算法竞赛-入门经典 第二部分 算法篇 第五章 2(Big Number)

    这里的高精度都是要去掉前导0的, 第一题:424 - Integer Inquiry UVA:http://uva.onlinejudge.org/index.php?option=com_onlin ...

  3. 刘汝佳 算法竞赛-入门经典 第二部分 算法篇 第六章 1(Lists)

    127 - "Accordian" Patience 题目大意:一个人一张张发牌,如果这张牌与这张牌前面的一张或者前面的第三张(后面称之为一位置和三位置)的点数或花式相同,则将这张 ...

  4. 刘汝佳 算法竞赛-入门经典 第二部分 算法篇 第六章 2(Binary Trees)

    112 - Tree Summing 题目大意:给出一个数,再给一颗树,每个头节点的子树被包含在头节点之后的括号里,寻找是否有从头节点到叶子的和与给出的数相等,如果有则输出yes,没有输出no! 解题 ...

  5. 算法竞赛入门经典第二版 TeX中的引号 P47

    #include<bits/stdc++.h> using namespace std; int main(){ ; while( (c = getchar()) !=EOF) //get ...

  6. 算法竞赛入门经典第二版 蛇形填数 P40

    #include<bits/stdc++.h> using namespace std; #define maxn 20 int a[maxn][maxn]; int main(){ ; ...

  7. 算法竞赛入门经典第二版 竖式问题 P42

    #include<bits/stdc++.h> using namespace std; int inset(char *s,int num) { //判断数字是否在数字集中 int le ...

  8. 算法竞赛入门经典第二版 回文词P49

    #include<bits/stdc++.h> using namespace std; char rev[]="A 3 HIL JM O 2TUVWXY51SE Z 8 &qu ...

  9. 算法竞赛入门经典第二版第二章习题-(练习Java和C++语法)

    习题2-1水仙花数(daffodil) 输出1000-999中所有的水仙花数.若三位数ABC满足ABC = A3+B3+C3,则称其为水仙花数. Java: package suanfa; publi ...

随机推荐

  1. .net 动态编译解决考勤计算问题

    由于公司实施SAP HR项目,但是SAP HR对考勤功能真的太弱化了,直接从考勤机上读取的原始打卡记录不能直接传输到HR系统里面,因为SAP HR不能识别那些多余的打卡记录,而且必须把打卡记录进行成组 ...

  2. Android or iOS 运行 meteor App 屏幕一片空白 White screen的解决方法

    在mac上出现这种错误,多是与文件夹的权限有关,有人建议把~/.meteor目录删除,重新下载安装.在墙内重新下载安装的代价非常之大. 简单的解决方法,便是把~/.meteor,以及当前项目目录的权限 ...

  3. win8.1上安装vc6

    win8.1上安装vc6 1.以管理员方式运行SETUP.EXE,然后一路下一步 2.这里需要一点点耐心,等10分钟左右就能过去,电脑会比较卡,有点像假死,还是没有死掉,等等就好了 3.这里选择vc6 ...

  4. Matlab实现加性高斯白噪声信道(AWGN)下的digital调制格式识别分类

    Matlab实现加性高斯白噪声信道(AWGN)下的digital调制格式识别分类 内容大纲 加性高斯白噪声信道(AWGN)下的digital调制格式识别分类 (1. PSK; 2. QPSK; 3.8 ...

  5. linux内核打印"BUG: scheduling while atomic

    linux内核打印"BUG: scheduling while atomic"和"bad: scheduling from the idle thread"错误 ...

  6. VRP-Lua学习笔记

    至于vrp是什么东西以及为什么要学习vrp,vrp的简单操作这些问题请自行右转抵拢倒拐找百度或者去中视典官网去找教程,我这里不会在赘述. 今天默认我们已经会使用VRP的脚本编辑器,用其他语言来为VRP ...

  7. 51nod 1109 01组成的N的倍数

    用01 组成 N的最小倍数 这个BFS搜索就好. 类似这道:  ZOJ Problem Set - 1530 每次 要么是0 要么是1, 记入余数,和前驱. #include<bits/stdc ...

  8. Ant学习---第二节:Ant添加文件夹和文件夹集的使用

    一.创建 java 项目(Eclipse 中),结构图如下: 1.创建 .java 文件,代码如下: package com.learn.ant; public class HelloWorld { ...

  9. 团队项目的NABC(截图软件)

    我们小组要开发的软件是基于windows上的截图软件,其NABC如下. 1.need: 首先,截图工具是几乎每个用户都会用到的,不管是在工作中,还是在学习上,其针对的人群从学生到上班族不等, 所以,他 ...

  10. 团队开发---NABC分析

    我们的软件初步构想的是版主同学们解决宿舍订桶装水的问题,随着夏季的来临,桶装水的需求量日益加大,而我们订水的过程中常常会遇到这样或那样的问题.再次我只对我们项目中可以直观的看到今日卖家总库存水量和剩余 ...