随笔分类 - 刷题
摘要:问题描述 你的表妹正在学习整数的加法,请编写一个程序来帮助她学习。该程序调用了一个函数GetTwoInts,由它来返回两个从键盘读入的100以内的整数,然后计算这两个整数之和,并把答案显示出来。要求:在主函数中不能使用scanf等函数直接输入这两个整数,而必须通过调用GetTwoInts函数来完成,
阅读全文
摘要:#include<iostream> #include<cstring> #include<iomanip> #include<cmath> #include<algorithm> #include<bits/stdc++.h> using namespace std; int N, M; int
阅读全文
摘要:Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 113547 Accepted: 26078 问题描述 George took sticks of the same length and cut them rando
阅读全文
摘要:问题描述 100 可以表示为带分数的形式:100 = 3 + 69258 / 714。 还可以表示为:100 = 82 + 3546 / 197。 注意特征:带分数中,数字1~9分别出现且只出现一次(不包含0)。 类似这样的带分数,100 有 11 种表示法。 输入格式 从标准输入读入一个正整数N
阅读全文
摘要:#include <iostream> #include<cstdio> using namespace std; #define maxn 105 char field[maxn][maxn]; int n,m; void dfs(int x,int y) { field[x][y]='.';//
阅读全文
摘要:用二维数组存二叉树 思路1:两个数组分别存左儿子和右儿子的编号,一个数组用来存值 #include<iostream> #include<cstdio> #include<sstream> #include<cstring> using namespace std; const int maxn =
阅读全文
摘要:putchar函数的作用:向终端输出一个字符。 (1)putchar函数只能用于单个字符的输出,且一次只能输出一个字符。 (2)在程序中使用putchar函数,务必牢记:在程序(或文件)的开头加上编译预处理命令(也称包含命令),即:#include "stdio.h" #include<bits/s
阅读全文
摘要:问题描述 Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1。 当n比较大时,Fn也非常大,现在我们想知道,Fn除以10007的余数是多少。 输入格式 输入包含一个整数n。 输出格式 输出一行,包含一个整数,表示Fn除以10007的余数。 说明:在本题中,答案是要求Fn
阅读全文