Commit baa9e29 1 parent b428ecf commit baa9e29 Copy full SHA for baa9e29
File tree 8 files changed +165
-0
lines changed
8 files changed +165
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ using namespace std ;
3
+ int main (){
4
+ int a,b;
5
+ cin >> a >> b;
6
+ cout << (a + b) << endl;
7
+ }
Original file line number Diff line number Diff line change
1
+ import java .util .*;
2
+ import java .math .BigDecimal ;
3
+
4
+ class Solution {
5
+ public static void main (String []args ){
6
+ Scanner sc = new Scanner (System .in );
7
+
8
+ while (sc .hasNext ()){
9
+ BigDecimal a = sc .nextBigDecimal ();
10
+ int n = sc .nextInt ();
11
+ a .pow (n );
12
+ String str = a .toPlainString ();
13
+
14
+ if (str .startsWith ("0." ))
15
+ {
16
+ str = str .substring (1 );
17
+ }
18
+
19
+ System .out .println (str );
20
+ }
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ #include < cmath>
3
+ using namespace std ;
4
+ int main (){
5
+ float m;
6
+ while (cin >> m){
7
+ if (m == 0.00 ){
8
+ break ;
9
+ }
10
+
11
+ float s = 0 ;
12
+ int i = 0 ;
13
+ while (s < m){
14
+ ++i;
15
+ s += 1.0 / (i + 1 );
16
+ }
17
+
18
+ cout << i << " card(s)" << endl;
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ #include < iomanip>
3
+ using namespace std ;
4
+
5
+ int main (){
6
+ double amount,sum = 0.0 ,average;
7
+
8
+ for (int i = 0 ; i < 12 ; i++){
9
+ cin >> amount;
10
+ sum += amount;
11
+ }
12
+
13
+ average = sum / 12 ;
14
+ cout << " $" << average;
15
+ }
Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ #include < string>
3
+ #include < map>
4
+ #include < vector>
5
+ #include < algorithm>
6
+ using namespace std ;
7
+
8
+ int sortedCalculation (string s){
9
+ int ans = 0 ;
10
+ int n = s.size ();
11
+ for (int i = 0 ; i < n ; i++){
12
+ for (int j = i + 1 ; j < n ; j++){
13
+ if (s[i] > s[j]){
14
+ ans++;
15
+ }
16
+ }
17
+ }
18
+ return ans;
19
+ }
20
+
21
+ int main (){
22
+ int n,m;
23
+ string s;
24
+ map<int ,vector<string>> map;
25
+ cin >> n >> m;
26
+
27
+ for (int i = 0 ; i < m ; i++){
28
+ cin >> s;
29
+ map[sortedCalculation (s)].push_back (s);
30
+ }
31
+
32
+ for (std::map<int ,vector<string>>::iterator it=map.begin (); it!=map.end (); ++it){
33
+ sort (it->second .begin (),it->second .end ());
34
+ for (int i = 0 ; i < it->second .size () ; i++){
35
+ cout << it->second [i] << endl;
36
+ }
37
+ }
38
+ }
Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ #include < string>
3
+ #include < math.h>
4
+ #include < cstring>
5
+ using namespace std ;
6
+
7
+ int main (){
8
+ string s;
9
+ int count[26 ] = {0 };
10
+ int c = 4 ;
11
+
12
+ while (c--) {
13
+ getline (cin,s);
14
+ for (int i = 0 ; i < s.size () ; i++){
15
+ if (s[i] >= ' A' && s[i] <= ' Z' ){
16
+ count[s[i] - ' A' ]++;
17
+ }
18
+ }
19
+ }
20
+
21
+ int length = 0 ;
22
+
23
+ for (int i = 0 ; i < 26 ; i++){
24
+ length = max (length,count[i]);
25
+ }
26
+
27
+
28
+ for (int i = length ; i > 0 ; i--){
29
+ for (int j = 0 ; j < 26 ; j++){
30
+ if (count[j] >= i){
31
+ cout << " * " ;
32
+ }else {
33
+ cout << " " ;
34
+ }
35
+ }
36
+ cout << endl;
37
+ }
38
+
39
+ for (int i = 0 ; i < 26 ; i++){
40
+ cout << char (' A' + i) << ' ' ;
41
+ }
42
+ }
Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ using namespace std ;
3
+
4
+ int main (){
5
+ int n,ways = 0 ;
6
+ cin >> n;
7
+
8
+ for (int i = 1 ; i <= n; i++){
9
+ int sum = 0 ;
10
+ for (int j = i ; j <= n ; j++){
11
+ sum += j;
12
+ if (sum > n) break ;
13
+ if (sum == n){
14
+ ways++;
15
+ break ;
16
+ }
17
+ }
18
+ }
19
+
20
+ cout << ways << endl;
21
+ }
You can’t perform that action at this time.
0 commit comments