# 蓝桥杯刷题打卡Day6

T1

#include <stdio.h>

#include <stdlib.h>

int main(int argc, char *argv[]) {

int dayplus = 1;

for (int i = 1; i < 11; i++) {

dayplus = dayplus * 400 % 7;

}

printf("%d", 6+dayplus);

}

T2

#include <stdio.h>

#include <stdlib.h>

void sort(long long int temp[], double n) {

int i = (int)n / 2 + 0.5;

long long int temp1[i];

long long int temp2[(int)n - i];

for (int j = 0; j < i; j++) {

temp1[j] = temp[j];

}

for (int k = 0; k + i < n; k++) {

temp2[k] = temp[k + i];

}

if (n > 2) {

sort(temp1, (double)sizeof(temp1) / 8);

sort(temp2, (double)sizeof(temp2) / 8);

}

int *p1 = temp1, *p2 = temp2, *p3 = temp;

while (p3 != temp + (int)n) {

if (p1 == temp1 + i) {

*p3 = *p2;

p2++;

}

else if (p2 == temp2 + (int)n - i) {

*p3 = *p1;

p1++;

} else {

if (*p1 < *p2) {

*p3 = *p1;

p1++;

} else {

*p3 = *p2;

p2++;

}

}

p3++;

}

}

int main(int argc, char *argv[]) {

int n;

scanf("%d", &n);

char temp[20];

long long int ID[n];

for (int i = 0; i < n; i++) {

scanf("%s %lld", temp, &ID[i]);

getchar();

}

sort(ID, (double)sizeof(ID ) / 8);

for (int i = 0; i < n; i++) {

if (ID[i + 1] == ID[i])

printf("\n");

else

printf("%lld\n\n", ID[i]);

}

}

T3

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

int main(int argc, char *argv[]) {

long long int n;

scanf("%lld", &n);

int k = (int)ceil((sqrt(1 + 8 * (double)n) - 1) / 2);

printf("%d", k);

}

...全文
6 回复 打赏 收藏 转发到动态 举报

49,439

• 近7日
• 近30日
• 至今

刷题！