随笔分类 - 5.1简单数学
摘要:英文题目:1104 Sum of Number Segments 中文题目:1049 数列的片段和 1 #include<iostream> 2 using namespace std; 3 4 int main() { 5 int n; 6 double t,sum = 0; 7 cin>>n;
阅读全文
摘要:英文题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805354762715136 中文题目:https://pintia.cn/problem-sets/994805260223102976/problems/994
阅读全文
摘要:英文版题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805350316752896 中文版题目:https://pintia.cn/problem-sets/994805260223102976/problems/9
阅读全文
摘要:大致题意就是给出包含N个元素的序列,判断其是否是N皇后的解。 已知每个坐标(x,f(x))的横坐标x不同,只需比较 1,列坐标是否相同f(x)(f(x1) - f(x2) == 0)。 2,两个坐标是否在同一对角线上(x1-x2 == |f(x1)-f(x2)|)。 满足1或2都不是解。 1 #in
阅读全文
摘要:题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805347145859072 ps:我英语好菜,没能理解题意。 1 #include<iostream> 2 using namespace std; 3 int
阅读全文
摘要:由于给出的数可能超出 long long范围,所以不能对两数直接求和,必须模拟加法运算过程,不然最后一个测试点无法通过。 中文版。 1079 延迟的回文数 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 bo
阅读全文
摘要:题目: 某公司使用某种原材料加工两种规格的产品其中生产每件A产品消耗原材料56kg生产每件B产品消耗原材料64kg。假设该公司现有800kg的原材料编写程序计算A、B各生存多少件剩余的原材料最少? 分析: 由题意可以得出一个二元一次方程:56*x + 64*y <= 800,通过两个for循环暴力求
阅读全文
摘要:水题。 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int main() { 6 int n,id,x,y, MIN = 0x3fffffff,MAX = -1,champion,vegetableBir
阅读全文
摘要:注意点:如果输入的数是 回文数,那么无需计算,直接输出即可。 这题和 B1019数字黑洞 类似,用string处理 即可! ps:第一次做时,写了68行,第二次做时,写了38行。。。 1 #include<iostream> 2 #include<algorithm> 3 using namespa
阅读全文
摘要:水题。 #include<iostream> using namespace std; int main() { int n,a[10],sum = 0; cin>>n; for(int i = 0; i < n; ++i) cin>>a[i]; for(int i = 0; i < n; ++i)
阅读全文
摘要:找规律的题目。 题目: 分析: 举例(1,2,3,4)有4个元素,下面是所有可能片段。 情况一,(1),(1,2),(1,2,3),(1,2,3,4),所有片段共有4个1,所以是 4 x 1 x 1 情况二,(2),(2,3),(2,3,4),情况一、二各有3个2,所以是 3 x 2 x 2 情况三
阅读全文
摘要:注意:位数不够四位,就高位补0; 新学一个string函数。str.insert(pos,N,字符)表示在pos位置,插入N个字符。 #include"iostream" #include<algorithm> using namespace std; bool cmp(char a,char b)
阅读全文
摘要:这道题是一道找规律的题目。第一次做时,看了半天题意看不懂。 第3个条件是第2个条件的一种延申。 对于条件2,AAPATAA“答案正确”,再看条件3,AAPAATAAAA必然“答案正确” 对于条件2,AAPAATAAAA“答案正确”,再看条件3,AAPAAATAAAAAA必然答案正确。 ... ...
阅读全文

浙公网安备 33010602011771号