File tree Expand file tree Collapse file tree 4 files changed +74
-3
lines changed Expand file tree Collapse file tree 4 files changed +74
-3
lines changed Original file line number Diff line number Diff line change
1
+
2
+ #include < iostream>
3
+ #include < bitset>
4
+ using namespace std ;
5
+
6
+ bool group (string str) {
7
+ bitset<26 > bits;
8
+ char pin = str[0 ];
9
+ bits.set (str[0 ]-97 );
10
+ for (int i=1 ; i<str.length (); i++) {
11
+ int val = str[i] - 97 ;
12
+ if (pin == str[i]) continue ;
13
+ if (pin != str[i] && bits.test (val)) return false ;
14
+ else if (pin != str[i] && !bits.test (val)) bits.set (val);
15
+ pin = str[i];
16
+ }
17
+ return true ;
18
+ }
19
+
20
+ int main () {
21
+ int n; cin>>n;
22
+ string word;
23
+ int cnt = 0 ;
24
+ for (int i=0 ; i<n; ++i) {
25
+ cin >> word;
26
+ if (group (word)) cnt++;
27
+ }
28
+ cout<<cnt;
29
+ return 0 ;
30
+ }
Original file line number Diff line number Diff line change
1
+
2
+ #include < iostream>
3
+ #include < string>
4
+ #include < algorithm>
5
+ using namespace std ;
6
+
7
+ int main () {
8
+ string first;
9
+ string second;
10
+ cin>>first>>second;
11
+ reverse (first.begin (), first.end ());
12
+ reverse (second.begin (), second.end ());
13
+ if (stoi (first) > stoi (second)) cout<<first;
14
+ else cout<<second;
15
+ return 0 ;
16
+ }
Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ using namespace std ;
3
+
4
+ int dial (char c) {
5
+ int val = (int )c -65 ;
6
+ if (val/3 == 0 ) return 3 ;
7
+ if (val/3 == 1 ) return 4 ;
8
+ if (val/3 == 2 ) return 5 ;
9
+ if (val/3 == 3 ) return 6 ;
10
+ if (val/3 == 4 ) return 7 ;
11
+ if (15 <= val && val<=18 ) return 8 ;
12
+ if (19 <= val && val<=21 ) return 9 ;
13
+ if (22 <=val && val<=25 ) return 10 ;
14
+ return 0 ;
15
+ }
16
+ int main () {
17
+ string input;
18
+ Cin >> input;
19
+ int time = 0 ;
20
+ for (int i=0 ; i<input.length (); i++) {
21
+ time += dial (input[i]);
22
+ }
23
+ cout<<time;
24
+ return 0 ;
25
+ }
Original file line number Diff line number Diff line change @@ -37,9 +37,9 @@ https://www.acmicpc.net/
37
37
| ** 1330** | ** 두 수 비교하기** | 2020.04.26| 1|
38
38
| ** 14681** | ** 사분면 고르기** | 2020.04.26| 1|
39
39
| ** 1152** | ** 단어의 개수** | 2020.08.15| 1|
40
- | **** | **** || |
41
- | **** | **** || |
42
- | **** | **** || |
40
+ | ** 2908 ** | ** 상수 ** | 2020.08.16 | 2 |
41
+ | ** 5622 ** | ** 다이얼 ** | 2020.08.16 | 4 |
42
+ | ** 1316 ** | ** 크로아티아 알파벳 ** | 2020.08.16 | 2 |
43
43
| **** | **** |||
44
44
| **** | **** |||
45
45
| **** | **** |||
You can’t perform that action at this time.
0 commit comments