ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¤å¦r¤Á³Î¡B­«²Õ

[µo°Ý] ¤å¦r¤Á³Î¡B­«²Õ

¤j®a¦n¡A¦³­Ó¦r¦ê¦p¤U
1 1 m2-10gb-xp-xfp up up
     2 m20-1gb-xp-sfp up up
2 1 m20-1gb-xp-sfp up up
3 1 m20-1gb-xp-sfp up up
     2 m20-1gb-xp-sfp up up
4 1 p6-10g-sfp up up
     2 p6-10g-sfp up up
5 1 m2-10gb-xp-xfp up up
     2 m20-1gb-xp-sfp up up
6 1 m1-10gb-xp-xfp up up
     2 m20-1gb-xp-sfp up up
7 1 m20-1gb-xp-sfp up up
8 1 m20-1gb-xp-sfp up up
     2 m20-1gb-xp-sfp up up
10 1 imm5-10gb-xp-xfp up up

§Ú¥D­n¬O­n§â¨C¤@¦æªº«e3ÄæºI¨ú¥X¼Æ¦r
¥H²Ä1¦æ¨Ó»¡
´N¬O
1 1 2
²Ä2¦æªº²Ä1Äæ¬OªÅ®æ¡A©Ò¥H­È©M²Ä1¦æªº­È¤@¼Ë
¬°
1 2 20
¦A¨Ó¬O
2 1 20
¥H¦¹Ãþ±À
³Ì«á´N¥i¥H¤Ï±À¥XPORTªº¶°¦X
1/1/1
1/1/2
1/2/1
1/2/2
¤¤¶¡¬Ù²¤
1/2/20
2/1/1
¤¤¶¡¬Ù²¤
2/1/20

½Ð°Ý«ç»ò°µ©O??
ÁÂÁÂ

¦^´_ 1# andyto202
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. using namespace std;

  5. int main(){
  6.     string inputString = "";
  7.     string numberString = "0123456789";
  8.     int countThree = 0, i, tempNumber;
  9.     vector<int> ans;
  10.    
  11.     while (getline(cin, inputString)) {
  12.         // Â÷¶}±ø¥ó
  13.         if (inputString == "q") {
  14.             break;
  15.         }
  16.         
  17.         i = countThree = tempNumber = 0;
  18.         while (countThree < 3 && i < inputString.length()) {
  19.             // ²Ä¤@­Ó¬OªÅ®æ¡A«h¸É¤W¤@¦¸ªº²Ä¤@­Óµª®×
  20.             if (i == 0 && inputString[i] == ' ') {
  21.                 ans.push_back(ans[ans.size() - 3]);
  22.                 countThree++;
  23.             }
  24.             
  25.             // ¤ñ¹ï¦pªG¬O¼Æ¦r
  26.             if (numberString.find(inputString[i]) != numberString.npos) {
  27.                 tempNumber = tempNumber * 10 + int(inputString[i]) - 48;
  28.             }
  29.             else{
  30.                 // ¤£¬O¼Æ¦r¡A«h§PÂ_tempNumber¬O§_¦³¼Æ¦r
  31.                 if (tempNumber != 0){
  32.                     ans.push_back(tempNumber);
  33.                     tempNumber = 0;
  34.                     countThree++;
  35.                 }
  36.             }
  37.             i++;
  38.         }
  39.     }
  40.    
  41.     // show ans
  42.     for (int j=0; j<ans.size(); j++) {
  43.         cout << ans[j] << " ";
  44.         if ((j+1) % 3 == 0) {
  45.             cout << endl;
  46.         }
  47.     }
  48.    
  49.     return 0;
  50. }
½Æ»s¥N½X
¿é¤J¡G
1 1 m2-10gb-xp-xfp up up
     2 m20-1gb-xp-sfp up up
2 1 m20-1gb-xp-sfp up up
3 1 m20-1gb-xp-sfp up up
     2 m20-1gb-xp-sfp up up
4 1 p6-10g-sfp up up
     2 p6-10g-sfp up up
5 1 m2-10gb-xp-xfp up up
     2 m20-1gb-xp-sfp up up
6 1 m1-10gb-xp-xfp up up
     2 m20-1gb-xp-sfp up up
7 1 m20-1gb-xp-sfp up up
8 1 m20-1gb-xp-sfp up up
     2 m20-1gb-xp-sfp up up
10 1 imm5-10gb-xp-xfp up up
q

¿é¥X¡G
1 1 2
1 2 20
2 1 20
3 1 20
3 2 20
4 1 6
4 2 6
5 1 2
5 2 20
6 1 1
6 2 20
7 1 20
8 1 20
8 2 20
10 1 5

TOP

ÀH·NºÛ "EXCEL°g"  blog  ©Îhttps://hcm19522.blogspot.com/ EXCEL¨ç¼Æ

TOP

¦^´_ 1# andyto202

¿é¥X©Ò¦³¶°¦X:
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <cstdlib>
  5. using namespace std;

  6. vector<int> ans;
  7. bool char_is_number(char c)
  8. {
  9.     string number_string = "0123456789";
  10.     if (number_string.find(c) != number_string.npos)
  11.     {
  12.         return true;
  13.     }
  14.     return false;
  15. }
  16. void get_three_number(string str)
  17. {
  18.     int count_three = 0, index = 0, temp_number = 0;
  19.     while (count_three < 3)
  20.     {
  21.         if (index == 0 && str[index] == ' ')
  22.         {
  23.             ans.push_back(ans[ans.size() - 3]);
  24.             count_three++;
  25.         }
  26.         else
  27.         {
  28.             if (char_is_number(str[index]))
  29.             {
  30.                 temp_number = temp_number * 10 + int(str[index]) - 48;
  31.             }
  32.             else
  33.             {
  34.                 if (temp_number != 0)
  35.                 {
  36.                     ans.push_back(temp_number);
  37.                     temp_number = 0;
  38.                     count_three++;
  39.                 }
  40.             }
  41.         }
  42.         index++;
  43.     }
  44. }
  45. int main()
  46. {
  47.     string inputString = "";
  48.     int countThree = 0, i, j;

  49.     while (getline(cin, inputString) && inputString != "q")
  50.     {
  51.         get_three_number(inputString);
  52.     }

  53.     // show ans
  54.     for (i = 0; i < ans.size(); i += 3)
  55.     {
  56.         for (j = 1; j <= ans[i + 2]; j++)
  57.         {
  58.             cout << ans[i] << "/" << ans[i + 1] << "/" << j << endl;
  59.         }
  60.         cout << endl;
  61.     }

  62.     system("PAUSE");
  63.     return 0;
  64. }
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¡i¬°µ½Ävª§¡j¤H¥Í­n¬°µ½Ävª§¡A¤À¬í¥²ª§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD