- ©«¤l
- 4
- ¥DÃD
- 0
- ºëµØ
- 0
- ¿n¤À
- 34
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows10
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2020-2-15
- ³Ì«áµn¿ý
- 2020-5-28
|
¦^´_ 1# andyto202
¿é¥X©Ò¦³¶°¦X:- #include <iostream>
- #include <string>
- #include <vector>
- #include <cstdlib>
- using namespace std;
- vector<int> ans;
- bool char_is_number(char c)
- {
- string number_string = "0123456789";
- if (number_string.find(c) != number_string.npos)
- {
- return true;
- }
- return false;
- }
- void get_three_number(string str)
- {
- int count_three = 0, index = 0, temp_number = 0;
- while (count_three < 3)
- {
- if (index == 0 && str[index] == ' ')
- {
- ans.push_back(ans[ans.size() - 3]);
- count_three++;
- }
- else
- {
- if (char_is_number(str[index]))
- {
- temp_number = temp_number * 10 + int(str[index]) - 48;
- }
- else
- {
- if (temp_number != 0)
- {
- ans.push_back(temp_number);
- temp_number = 0;
- count_three++;
- }
- }
- }
- index++;
- }
- }
- int main()
- {
- string inputString = "";
- int countThree = 0, i, j;
- while (getline(cin, inputString) && inputString != "q")
- {
- get_three_number(inputString);
- }
- // show ans
- for (i = 0; i < ans.size(); i += 3)
- {
- for (j = 1; j <= ans[i + 2]; j++)
- {
- cout << ans[i] << "/" << ans[i + 1] << "/" << j << endl;
- }
- cout << endl;
- }
- system("PAUSE");
- return 0;
- }
½Æ»s¥N½X |
|