#include <iostream>
using namespace std;
int main()
{
int n = 0;
cin >> n;
int sum = 0;
if(n % 2 != 0)
{
for (int i = 0; i < n; i+=2)
{
sum += i;
}
}
else
{
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= n; ++j)
{
if(i * j == n)
{
sum += i;
}
}
}
}
cout << sum << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n = 0;
cin >> n;
int sum = 0;
for (int i = 1; i <= n; ++i)
{
if(i % 3 == 0)
{
sum++;
}
}
cout << sum << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n = 0;
int m = 0;
cin >> n >> m;
for (int i = n; i <= m; ++i)
{
int sum = 0;
for (int j = 1; j <= i / 2; ++j)
{
if(i % j == 0)
{
sum += j;
}
}
if(sum == i)
{
cout << i << " ";
}
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n = 0;
cin >> n;
double money = 0;
for (int i = 0; i < n; ++i)
{
int temp = 0;
cin >> temp;
while(temp > 70)
{
temp -= 70;
money += 0.1;
}
money += 0.1;
}
printf("%.1lf", money);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n = 0;
cin >> n;
int sum = 0;
bool judge = false;
for (int i = 1;;++i)
{
sum = (i * (1 + i)) / 2;
for (int j = i; j >= 1; --j)
{
if (sum - j * 2 - j == n)
{
cout << j << " " << i << endl;
judge = true;
return 0;
}
}
if(judge == true)
{
break;
}
}
return 0;
}
|