题解列表

筛选

1198: 取石子游戏

摘要:核心:    威佐夫博弈 a == (int)((b - a) * ((sqrt(5) + 1) / 2)):先手输,其他则先手赢代码:from math import sqrt while T……

1197: 发工资咯(贪心算法)

摘要:核心:票票从大开始扣,数量是最少的代码:while True:     l = [int(x) for x in input().split()]     n = l[0]     if n =……

1159: 偶数求和

摘要:解题思路:注意事项:参考代码:#include<iostream> using namespace std; int main() { int n, m; while(cin >> n ……

题解 2773: 计算线段长度 math.h头文件

??解题思路??此题中两点之间存在四种情况:1.两点X坐标相同表示为:Xa==Xb解:两点Y坐标差值的绝对值2.两点Y坐标相同表示为:Ya==Yb解:两点X坐标差值的绝对值3.两点X,Y坐标均相同表示为:Xa==Xb&&Ya==Yb解:两点距离为04.两点X,

1157题解(C语言)

```c#include//函数yue_shu用于计算一个整数n的所有真约数(除了它本身)的和intyue_shu(intn){intsum=0;//初始化sum变量用于累加约数//遍历所有可能的约数i,从1到n/2(因为超过n/2的数不可能是n的约数)for(inti=1;i

指针/引用练习之交换数字

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int swap(int *a,int *b){ int  temp; temp=*a; *a=*b; *b=temp; return ……

1159题解(C语言)

```c#include#defineMAX101voidfun(intn,intm){inta[MAX];//存储生成的数字的数组intnum=0;//用于跟踪当前存储到数组中的数字//偶数for(inti=0;i

判断一年的第几天

摘要:参考代码:#include<stdio.h>struct date {    int year;    int month;    int day;};int main() {    struct d……

1160: 出圈 (vector , 公式法)

摘要:解题思路:Vector注意事项:删除元素的位置在末尾的时候,需要注意初始化为0参考代码:#include#include  using namespace std; int main() { ……