题解列表
1282: 公交汽车(动态规划)
摘要:核心:动态规划,dp数组代码:cost = [int(x) for x in input().split()]
n = int(input())
dp = [0] * n # dp[i]物品(站……
动态规划通用题解,学会了就都懂了
摘要:解题思路:二维数组填表来实现注意事项:vtype代表的是价值和体重的类型如果可以,自己实现一个函数不用max函数是最优解,即可达到动态规划公式参考代码:#include <iostream>using……
编写题解 2955: 判决素数个数
摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int c(int n){ if(n==1) return 0; for(int i……
计算整数总和(新玩法)
摘要:题目描述
你的任务是计算一些整数的总和。
输入格式
输入在第一行中包含整数 N,然后是 N 行。每行都以整数 M 开头,然后 M 整数跟在同一行中。
输出格式
对于每组输入整数,您应……
A+B for Input-Output Practice (IV)
摘要: #include
int main()
{
int i,n,num[100],sum;
while(~scanf("%d",&n)……
2875: 回文子串
摘要:解题思路:注意事项:参考代码:#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
us……
白细胞计数 学习新函数
摘要:解题思路:利用冒泡排序,直接从小到大排好数组顺序(或者利用algorithm库的sort函数排序)再利用cmath库求绝对值和较大的数省去重复利用if-else函数,使代码更简洁客观参考代码:int ……
排序(n个数从小到大)
摘要:
[========]
#include
void sort(int a[],int n) //定义一个排序函数sort
{
……