//1005 char a[105]; char* num[] = {"zero","one","two","three","four","five","six","seven","eight","nine"}; stack<char*> out; int main(){ while(s
题目描述: Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specification: Each input file contains one test case. Each case occupies one line which contains an N (
弱弱的我不会网络流,发现这道题二分图也能水过,直接匈牙利不比Dinic好写一些吗??? #include<bits/stdc++.h> using namespace std; int n,k,need[25],vis[1005],match[1005],ans; vector<int>a[25],c[25]; int dfs(int col){ //printf("%d\n",col); for(int i=0;i<a[col].si
卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。 当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对 n=3 进行验证的时候,我们需要计算 3、5、8、4、2、1,则当我们对 n=5、8、4、2 进行验证的时候,就可以直
#include <bits/stdc++.h> using namespace std; int a[1005][1005],n,x[1005]; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { scanf("%d",&a[i][j]); }
A - Drinks Choosing int cnt[1005]; void test_case() { int n, k; scanf("%d%d", &n, &k); for(int i = 1; i <= n; ++i) { int x; scanf("%d", &x); ++cnt[x]; } int cnt2 = 0; for(
Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of f(n). Input The input consists of multiple test cases. Each test case conta
因为成环 所以可以枚举第1只与第n只喂的次数 然后第1只和第2只的次数就固定了,以此类推,则所有宝可梦喂的次数都固定了 最后处理完检查是否全为0,不是则进行下一次枚举,是则直接输出Yes 如果所有枚举均不成立,输出No 1 /* 2 Written By. StelaYuri 3 On 2020/01/15 4 */ 5 #in
寻找从i到X,再从X到i的最短路 可以在正向图中从X开始跑一遍最短路,每个点的距离dis1[i]当作从X回到点i的距离 再将图反向从X再跑一遍,每个点的距离dis2[i]当作从i到点X的距离 最后搜索dis1[i]+dis2[i]值最大的输 1 /* 2 Written By StelaYuri 3 */ 4 #include<bits/stdc++.h> 5
1005 继续(3n+1)猜想 (25分) 卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。 当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对 n=3 进行验证的时候,我们需要计算 3、5、8、4、2、1,则当我们对 n=5、8、4
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specification: Each input file contains one test case. Each case occupies one line which contains an N (≤10 100
prufer序列为无根树的一种数列。长度为 $n - 2$prufer转无根树将最小编号的叶子删去,prufer序列加入其父亲。重复至树只剩下两个节点。无根树转prufer取出prufer首元素,与待选点集中最小未出现在prufer序列中的点连边,并将该点在待选点集中删去,直至待选点集剩下两个节点,将这两个节点
题目 题意:比较两个版本的大小 题解: class Solution { public: int ver1[1005]; int pos1; int pos2; int ver2[1005]; int compareVersion(string version1, string version2) { int i,j; string s=""; for(i=0;i<versi
第一页的题解链接 BZOJ 1000-1009 BZOJ 1000 BZOJ 1001 BZOJ 1002 BZOJ 1003 BZOJ 1004 BZOJ 1005 BZOJ 1006 BZOJ 1007 BZOJ 1008 BZOJ 1009
卡拉兹(Callatz)猜想已经在1001中给出了描述。在这个题目里,情况稍微有些复杂。 当我们验证卡拉兹猜想的时候,为了避免重复计算,可以记录下递推过程中遇到的每一个数。例如对 n=3 进行验证的时候,我们需要计算 3、5、8、4、2、1,则当我们对 n=5、8、4、2 进行验证的时候,就可以直
E - Wireless Network An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the network were all broken. The compu
1005:地球人口承载力估计 时间限制: 1000 ms 内存限制: 65536 KB 提交数: 49304 通过数: 27276 【题目描述】 假设地球上的新生资源按恒定速度增长。照此测算,地球上现有资源加上新生资源可供x亿人生活a年,或供y亿人生活b年。 为了能够实现可持续发展,避免资源枯竭,
https://codeforces.com/gym/101341/problem/I 题意: 给定三个矩阵ABC,问A*b是否等于c 代码: 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 5 long long mod = 1e9+7; 6 7 long long a[1005][1005], b[1005][1005], c[1005][1005]; 8 l
v奶牛Bassie去DQ打工,遇到一个客人给了一张好大面值的钞票,于是Bassie不得不为了给这位顾客找零而面对这样一个问题:现在店里一共有n种硬币,对这些不同种的硬币进行编号,编号为i的硬币面值为c[i] 。因为奶牛的手指头是有限的,因此他只能向你求助啦。(已知总需找零数为total)(1<=total<=1
# 题解 P3955 【图书管理员】(论图书管理员有多懒) 洛谷原版:https://www.luogu.com.cn/blog/jvruo-0076/solution-p3955 Some ideas 首先,读入并存入数组,排列。取余查找*,有就输出**,无输出-1 * 用循坏!千万别用pow函数。虽然洛谷上pow能过,但一个系统一个数据。别的网站由于实数整数原因
1005. K 次取反后最大化的数组和 描述: 给定一个整数数组 A,我们只能用以下方法修改该数组:我们选择某个个索引 i 并将 A[i] 替换为 -A[i],然后总共重复这个过程 K 次。(我们可以多次选择同一个索引 i。) 以这种方式修改数组后,返回数组可能的最大和。 示例 1: 输入:A = [4,2,3], K = 1
题目链接: https://pintia.cn/problem-sets/994805342720868352/problems/994805519074574336 题目描述: Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specification: Each i
luogu1387最大正方形 O(n^2) 1 #include<cstdio> 2 #include<algorithm> 3 using namespace std; 4 int f[105][105]; 5 //f[i][j]代表以i,j为右下角的前i,j区域内的最大正方形 6 int main() 7 { 8 int n,m,ans = 0; 9 scanf("%d%d",&n,&m); 10
题目描述 有一个邮递员要送东西,邮局在节点1.他总共要送N-1样东西,其目的地分别是2~N。由于这个城市的交通比较繁忙,因此所有的道路都是单行的,共有M条道路,通过每条道路需要一定的时间。这个邮递员每次只能带一样东西。求送完这N-1样东西并且最终回到邮局最少需要多少时间。 输入格
题目分析:用一个字符串输入之后遍历每一位求和后,不断%10获取最后一位存储下来,逆序用对应的英文单词输出(注意输入为0的情况) 1 #include<iostream> 2 #include<string> 3 using namespace std; 4 5 string a[10] = {"zero", "one", "two", "three", "four", &quo