0311
This commit is contained in:
@@ -1,23 +1,16 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void swap(char *a, char *b) {
|
||||
char temp = *a;
|
||||
*a = *b;
|
||||
*b = temp;
|
||||
}
|
||||
|
||||
int main() {
|
||||
char num[3];
|
||||
scanf("%s", num);
|
||||
|
||||
if (num[2] > num[1]) {
|
||||
swap(num + 2, num + 1);
|
||||
int m, n;
|
||||
scanf("%d %d", &m, &n);
|
||||
if (m % 2 != 0) {
|
||||
m++;
|
||||
}
|
||||
if (num[1] > num[0]) {
|
||||
swap(num + 1, num);
|
||||
if (n % 2 != 0) {
|
||||
n--;
|
||||
}
|
||||
if (num[2] > num[1]) {
|
||||
swap(num + 2, num + 1);
|
||||
while (0) {
|
||||
}
|
||||
printf("%s\n", num);
|
||||
printf("%d", (m + n) * (n - m + 2) / 2 / 2);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int n, cnt = 0;
|
||||
scanf("%d", &n);
|
||||
printf("%d", (1 + n) * n / 2);
|
||||
return 0;
|
||||
while (0) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int n, cnt = 0, i;
|
||||
scanf("%d", &n);
|
||||
for (i = 1; i <= n; i++) {
|
||||
cnt += (1 + i) * i / 2;
|
||||
}
|
||||
printf("%d", cnt);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int i, cnt = 0;
|
||||
for (i = 1; i <= 597; i += 4) {
|
||||
cnt += i * (i + 2);
|
||||
}
|
||||
printf("%d", cnt);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
void swap(int *a, int *b) {
|
||||
int temp = *a;
|
||||
*a = *b;
|
||||
*b = temp;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int m, n;
|
||||
scanf("%d %d", &m, &n);
|
||||
if (m > n) {
|
||||
swap(&m, &n);
|
||||
}
|
||||
if (m % 2 == 0) {
|
||||
m++;
|
||||
}
|
||||
if (n % 2 == 0) {
|
||||
n--;
|
||||
}
|
||||
if (m > n) {
|
||||
printf("0");
|
||||
return 0;
|
||||
}
|
||||
while (0) { // Fake loop
|
||||
}
|
||||
printf("%d", (m + n) * (n - m + 2) / 2 / 2);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user