ICode9

精准搜索请尝试: 精确搜索
  • 模拟退火2 P3878 [TJOI2010]分金币2022-04-03 16:31:44

    1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 ll ans,n,sum; 5 int a[100]; 6 7 int f() 8 { 9 int t=0; 10 for(int i=1;i<=n/2;i++)t+=a[i]; 11 return abs(sum-2*t); 12 } 13 void mnth() 14 { 15 for

  • Atcoder 212D Querying Multiset2021-08-12 23:03:47

    Problem Statement Takahashi has many balls, on which nothing is written, and one bag. Initially, the bag is empty. Takahashi will do Q operations, each of which is of one of the following three types. Type 1: Write an integer Xi on a blank ball and put i

  • 杭电oj 1258 Sum It Up2021-02-04 13:30:20

    dfs 要记录路径最后输出 #include <bits/stdc++.h> using namespace std; typedef long long ll; int sum,n,ans,x; /* sum和n是总和,ans用来记录是否有解,x是一个中间量,临时存数 */ int a[15],b[15];//数组a存放输入的数据,数组b存放路径 void dfs(int nowsum,int nowk,int bi)

  • Week3:选数问题——dfs遍历2020-03-06 19:04:21

    A-选数问题 题目内容 给出n个正整数,从中选出K个数,使满足这些数的和等于S。 求出总共有多少种选择方式。 输入格式 输入包含多个测试样例。 第一行给出一个正整数T(<=100)为测试样例的数量。 接下来对于每个测试样例: 第一行包含三个正整数n,K,S; 第二行包含n个需要被选择的正

  • PAT A1007 Maximum Subsequence Sum2019-09-06 13:35:55

    知识点: 动态规划:最大连续子序列之和 题意 求最大连续子序列之和,输出最大的和以及这个子序列的首尾元素。如果所有数都小于0,那么认为最大和为0,并且输出整个序列的首尾元素。如果有多组答案,输出下标最小的那组。 思路 在读入时累加和到nowSum,如果nowSum为负,说明一组正数的和

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有