-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
356 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
int n; | ||
cin >> n; | ||
if (n % 2 == 0) | ||
cout << "YES"; | ||
else | ||
cout << "NO"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
int n; | ||
cin >> n; | ||
if (n >= 100 && n <= 999) | ||
cout << "YES"; | ||
else | ||
cout << "NO"; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
float n; | ||
cin >> n; | ||
int k = int(n); | ||
|
||
if (n == k) | ||
cout << "YES"; | ||
else | ||
cout << "NO"; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
long long a, b, c; | ||
cin >> a >> b >> c; | ||
long long max = a; | ||
if (max < b) | ||
max = b; | ||
if (max < c) | ||
max = c; | ||
|
||
cout << max; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
long long a, b; | ||
cin >> a >> b; | ||
long long sum; | ||
sum = ((a+b)*(b-a+1))/2; | ||
cout << sum; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main(){ | ||
int n; | ||
cin >> n; | ||
for (int i = 1; i <= 10; i++) | ||
cout << n << " x " << i << " = " << n * i << endl; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int a[100000]; | ||
|
||
int main(){ | ||
int n; | ||
cin >> n; | ||
for (int i = 0; i < n; i++) | ||
cin >> a[i]; | ||
|
||
sort(a, a + n); | ||
|
||
for (int i = 0; i < n; i++) | ||
cout << a[i] << " "; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int a[100009]; | ||
|
||
int main(){ | ||
int n; | ||
cin >> n; | ||
for (int i = 0; i < n; i++) | ||
cin >> a[i]; | ||
|
||
sort(a, a + n); | ||
|
||
// for (int i = 0; i < n; i++) | ||
// cout << a[i] << " "; | ||
|
||
int count = 1; | ||
for (int i = 1; i < n; i++) | ||
if (a[i] != a[i - 1]) | ||
count++; | ||
|
||
cout << count; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
string s; | ||
getline(cin, s); | ||
for (int i = 0; i < s.length(); i++) { | ||
if (s[i]>='a' && s[i]<='z') | ||
s[i] -= 32; | ||
} | ||
cout << s; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include <iostream> | ||
#include <cmath> | ||
using namespace std; | ||
|
||
int main() { | ||
int n,k; | ||
cin>>n>>k; | ||
|
||
int a[n]; | ||
|
||
for (int i =0;i<n;i++){ | ||
cin >>a[i]; | ||
} | ||
|
||
for(int i =0;i<n;i++){ | ||
for(int j = i+1 ;j<n;j++){ | ||
if(a[i] < a[j]){ | ||
swap(a[i],a[j]); | ||
} | ||
} | ||
} | ||
int dem =0; | ||
int hang=0; | ||
int t=0; | ||
for(int i =0;i<n;i++){ | ||
|
||
if(a[i]!=0){ | ||
t=t+a[i]; | ||
dem++; | ||
hang++; | ||
} | ||
|
||
if(hang >= k){ | ||
break; | ||
} | ||
} | ||
if(t==0) cout<<"0"; | ||
else | ||
cout <<dem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
< n; i++) | ||
// cout << a[i] << " "; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
long long n; | ||
cin >> n; | ||
|
||
if (n >= 10 && n <= 99) | ||
cout << "YES"; | ||
else | ||
cout << "NO"; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
long long n; | ||
cin >> n; | ||
// n = 123 | ||
int sum = 0; | ||
|
||
while (n > 0) { | ||
int d = n % 10; | ||
sum = sum + d; | ||
n = n / 10; | ||
} | ||
|
||
cout << sum; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
long long sum(long long n) { | ||
return n * (n + 1) / 2; | ||
} | ||
|
||
int main() { | ||
long long a, b; | ||
cin >> a >> b; | ||
cout << sum(b) - sum(a - 1); | ||
} | ||
|
||
// 1 2 3 ... a-1 a ... b |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
long long a; | ||
cin >> a; | ||
long long sum = a * (a + 1) / 2; | ||
cout << sum; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int a[100009]; | ||
|
||
int main() { | ||
int n; | ||
cin >> n; | ||
for (int i = 0; i < n; i++) | ||
cin >> a[i]; | ||
|
||
for (int i = 0; i < n; i++) | ||
if (a[i] % 2 == 0 && i % 2 == 1) | ||
cout << a[i] << endl; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int a[100009]; | ||
|
||
int main() { | ||
int n; | ||
cin >> n; | ||
for (int i = 0; i < n; i++) | ||
cin >> a[i]; | ||
|
||
sort(a, a + n); | ||
|
||
for (int i = 0; i < n; i++) | ||
cout << a[i] << " "; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int a[1009][1009]; | ||
int b[1000009]; | ||
|
||
int main() { | ||
int m, n; | ||
cin >> m >> n; | ||
for (int i = 0; i < m; i++) { | ||
for (int j = 0; j < n; j++) { | ||
cin >> a[i][j]; | ||
} | ||
} | ||
|
||
// chuyen mang 2 chieu ve mang 1 chieu | ||
int index = 0; | ||
for (int i = 0; i < m; i++) { | ||
for (int j = 0; j < n; j++) { | ||
b[index] = a[i][j]; | ||
index = index + 1; | ||
} | ||
} | ||
|
||
// sap xep mang 1 chieu | ||
sort(b, b + m * n); | ||
|
||
// for (int i = 0; i < m * n; i++) | ||
// cout << b[i] << " "; | ||
|
||
// Dua mang 1 chieu da sap xep ve mang 1 chieu | ||
index = 0; | ||
for (int i = 0; i < m; i++) { | ||
for (int j = 0; j < n; j++) { | ||
a[i][j] = b[index]; | ||
index = index + 1; | ||
} | ||
} | ||
|
||
cout << "Mang sau khi da sap xep" << endl; | ||
|
||
for (int i = 0; i < m; i++) { | ||
for (int j = 0; j < n; j++) { | ||
cout << a[i][j] << " "; | ||
} | ||
cout << endl; | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
string s; | ||
getline(cin, s); | ||
|
||
bool check = false; | ||
|
||
for (int i = 0; i < s.length(); i++) | ||
if (s[i] == ' ') | ||
check = true; | ||
|
||
if (check == false || s.length() > 100) | ||
cout << "N"; | ||
else { | ||
for (int i = 0; i < s.length(); i++) | ||
if (s[i] == ' ') | ||
cout << endl; | ||
else | ||
cout << s[i]; | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
int a[1009][1009]; | ||
|
||
int main() { | ||
int m, n; | ||
cin >> m >> n; | ||
for (int i = 0; i < m; i++) { | ||
for (int j = 0; j < n; j++) { | ||
cin >> a[i][j]; | ||
} | ||
} | ||
|
||
for (int i = 0; i < m; i++) { | ||
for (int j = 0; j < n; j++) { | ||
cout << a[i][j] << " "; | ||
} | ||
cout << endl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
i < m * n; i++) | ||
// cout << b[i] << " "; |