#include<iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b << endl;
system("pause");
return 0;
}
#include<iostream>
using namespace std;
#include<set>
int main()
{
int n;
cin >> n;
int number=0;
multiset<int>mu;
for (int i = 0;i < n;i++)
{
cin >> number;
mu.insert(number);
}
for (multiset<int>::iterator it = mu.begin();it != mu.end();it++)
{
cout << *it << " ";
}
cin >> n;
}
#include<iostream>
using namespace std;
#include<string>
#include<vector>
int main()
{
string str;
vector<string>v;
int n;
long long sum = 0;
int start;
int llx;
vector<int>v1;
cin >> n;
for (int i = 0;i < n;i++)
{
cin >> str;
v.push_back(str);
}
string str1;
for (vector<string>::iterator it = v.begin();it != v.end();it++)
{
llx = (*it).length();
start = 1;
sum = 0;
v1.clear();
for (int i = (llx-1);i >= 0;i--)
{
if ((int)(*it)[i] >= 48 && (int)(*it)[i] <= 57)
{
sum += (((int)(*it)[i] - 48) * (start));
start *= 16;
}
else
{
sum += (((int)(*it)[i] - 55) * (start));
start *= 16;
}
}
while (sum!=0)
{
v1.insert(v1.begin(),sum % 8);
sum /= 8;
}
for (vector<int>::iterator itt = v1.begin();itt != v1.end();itt++)
{
cout << *itt;
}
cout << endl;
}
system("pause");
return 0;
}
#include<iostream>
using namespace std;
#include<string>
#include<vector>
int arr[400000] = {};
int main()
{
string str;
vector<string>v;
int n;
int num;
int start;
int llx;
vector<int>v1;
cin >> n;
for (int i = 0;i < n;i++)
{
cin >> str;
v.push_back(str);
}
string str1;
int times;
int jin;
int sum;
vector<int>::iterator pos;
for (vector<string>::iterator it = v.begin();it != v.end();it++)
{
llx = (*it).length();
start = 1;
v1.clear();
times = 0;
jin = 0;
for (int i = (llx-1);i >= 0;i--)
{
if ((int)(*it)[i] >= 48 && (int)(*it)[i] <= 57)
{
num = ((int)(*it)[i] - 48);
jin = times + 4;
while (num != 0||times<jin)
{
if (num != 0)
{
arr[times] = num % 2;
num /= 2;
times++;
}
else
{
arr[times] = 0;
times++;
}
}
}
else
{
num = ((int)(*it)[i] - 55);
jin = times + 4;
while (num != 0 || times < jin)
{
if (num != 0)
{
arr[times] = num % 2;
num /= 2;
times++;
}
else
{
arr[times] = 0;
times++;
}
}
}
}
if (times % 3 == 1)
{
arr[times + 1] = 0;
arr[times + 2] = 0;
times += 2;
}
else if (times % 3 == 2)
{
arr[times + 1] = 0;
times += 1;
}
for (int i = 0;i < times;i += 3)
{
sum = 0;
sum += arr[i];
sum += arr[i + 1] * 2;
sum += arr[i + 2] * 4;
v1.insert(v1.begin(), sum);
}
pos = v1.begin();
while (*pos == 0)
{
pos++;
}
for (vector<int>::iterator itt = pos;itt != v1.end();itt++)
{
cout << *itt;
}
cout << endl;
v1.clear();
}
system("pause");
return 0;
}
?
?
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
string str;
cin >> str;
long long sum = 0;
long long start = 1;
int l = str.length();
vector<int>v;
if (str == "0")
{
cout << 0;
return 0;
}
for (int i = l - 1;i >= 0;i--)
{
if ((int)str[i] >= 48 && (int)str[i] <= 57)
{
sum += ((int)str[i] - 48) * start;
start *= 16;
}
else
{
sum += ((int)str[i] - 55) * start;
start *= 16;
}
}
while (sum)
{
v.insert(v.begin(), sum % 10);
sum /= 10;
}
for (vector<int>::iterator it = v.begin();it != v.end();it++)
{
cout << *it;
}
system("pause");
return 0;
}
?
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
long long num;
cin >> num;
vector<char>v;
int flag;
if (num == 0)
{
cout << 0 << endl;
return 0;
}
while (num != 0)
{
flag = num % 16;
num /= 16;
if (flag >= 0 && flag <= 9)
{
v.insert(v.begin(), (char)(flag+48));
}
else
{
v.insert(v.begin(), (char)(flag+55));
}
}
for (vector<char>::iterator it = v.begin();it != v.end();it++)
{
cout << *it;
}
system("pause");
return 0;
}
?
#include<iostream>
using namespace std;
#include<set>
int main()
{
int n;
cin >> n;
multiset<int>mu;
int num;
for (int i = 1;i < 10;i++)
{
for (int j = 0;j < 10;j++)
{
for (int z = 0;z < 10;z++)
{
if ((i * 2 + j * 2 + z * 2) == n)
{
num = i * 100000 + j * 10000 + z * 1000 + z * 100 + j * 10 + i;
mu.insert(num);
}
else if ((i * 2 + j * 2 + z) == n)
{
num = i * 10000 + j * 1000 + z * 100 + j * 10 + i;
mu.insert(num);
}
}
}
}
for (multiset<int>::iterator it = mu.begin();it != mu.end();it++)
{
cout << *it << endl;
}
system("pause");
return 0;
}
?
?
#include<iostream>
using namespace std;
int main()
{
for (int i = 1;i <= 9;i++)
{
for (int j = 0;j <= 9;j++)
{
cout << i << j << j << i << endl;
}
}
system("pause");
return 0;
}
?
?
#include<iostream>
using namespace std;
int main()
{
int a, b, c;
for (int i = 100;i < 1000;i++)
{
a = i / 100;
b = i / 10 - a * 10;
c = i % 10;
if (a*a*a+b*b*b+c*c*c == i)
{
cout << i << endl;
}
}
system("pause");
return 0;
}
?
#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int arr[35][35] = {};
arr[0][0] = 1;
for (int i = 1;i < 35;i++)
{
for (int j = 0;j < 35;j++)
{
if (i - 1 >= 0 && j - 1 >= 0)arr[i][j] += arr[i - 1][j - 1];
if (i - 1 >= 0)arr[i][j] += arr[i - 1][j];
}
}
for (int i = 0;i < n;i++)
{
for (int j = 0;j <= i;j++)
{
cout << arr[i][j] << " ";
}
cout << endl;
}
system("pause");
return 0;
}
?
#include<iostream>
using namespace std;
#include<vector>
int main()
{
int n;
cin >> n;
int num;
vector<int>v;
for (int i = 0;i < n;i++)
{
cin >> num;
v.push_back(num);
}
int number;
cin >> number;
vector<int>::iterator pos;
pos = find(v.begin(), v.end(), number);
if (pos != v.end())
{
cout << pos-v.begin()+1 << endl;
}
else
{
cout << -1 << endl;
}
system("pause");
return 0;
}
#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int arr[1001];
int start = 1;
int number;
for (int i = 0;i < n;i++)
{
cin >> number;
arr[i] = number;
}
cin >> number;
for (int i = 0;i < n;i++)
{
if (number == arr[i])
{
cout << start;
break;
}
start++;
}
if (start == n + 1)
{
cout << -1 << endl;
}
system("pause");
return 0;
}
?
#include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int arr[10000] = {};
int min = 10000;
int max = -10000;
int sum = 0;
int number;
for (int i = 0;i < n;i++)
{
cin >> number;
if (number < min)min = number;
if (number > max)max = number;
sum += number;
}
cout << max << endl;
cout << min << endl;
cout << sum << endl;
system("pause");
return 0;
}
?
#include<iostream>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
int arr[26][26] = {};
int num = 65;
int flag = 1;
for (int i = 0;i < 26;i++)
{
flag = 1;
num = 65 + i;
for (int j = 0;j < 26;j++)
{
if (flag == 1)
{
arr[i][j] = num;
if (num == 65)
{
num++;
flag = 0;
}
else
{
num--;
}
}
else if (flag == 0)
{
arr[i][j] = num;
num++;
}
}
}
for (int i = 0;i < n;i++)
{
for (int j = 0;j < m;j++)
{
cout << (char)(arr[i][j]);
}
cout << endl;
}
system("pause");
return 0;
}
?
?