02 2023 档案
摘要:记得变量要用long long型,刚开始下标是从0开始的,我说怎么一直不对。。 1 #include <iostream> 2 #include <stdio.h> 3 using namespace std; 4 5 int main() 6 { 7 int n; 8 scanf("%d",&n)
阅读全文
摘要:题不难,但是代码有一个结果报错,猜测可能如果输入0000234的话,可能会输出-1?先标记一下看看别人的 #include <iostream> #include <stdio.h> using namespace std; int main() { int n; int arr[1000]={0}
阅读全文
摘要:算法笔记原题 #include <iostream> #include <stdio.h> using namespace std; int main() { int num=0; char ans[90][90]; while(scanf("%s",ans[num])!=EOF) { num++;
阅读全文
摘要:这个还是比较简单的 1 #include <iostream> 2 #include <stdio.h> 3 using namespace std; 4 5 int main() 6 { 7 int n,m; 8 scanf("%d %d",&n,&m); 9 m=m%n; 10 int arr[
阅读全文
摘要:刚开始打算用数组储存的,总是把问题想得太复杂了。 1 #include <iostream> 2 #include <math.h> 3 #include <stdio.h> 4 using namespace std; 5 6 bool IsPrime(int m); 7 int main() 8
阅读全文
摘要:第一次写的实在太垃圾,没必要对n进行判定的。 1 #include <iostream> 2 #include <stdio.h> 3 using namespace std; 4 5 int main() 6 { 7 int n; 8 scanf("%d",&n); 9 if(n>100) 10
阅读全文
摘要:思路:上网看了别人可以用散列做,大概思路: (1)设置一个mark初始化为-1的数组,并将输入的n个数的每个数作为mark的下标并使值为0. (2)然后在套用for循环进行遍历,例如3,遍历过后的58421都会使mark下标为58421的值为1. (3)最后设置输出的时候,用flag进行判定,如果f
阅读全文
摘要:两种方法,一种是常规的,另一种还可以用栈来解决,能力实在有限。也是刚接触,脑子转不过来,-'0'就是转换为数字,然后就是%10/10什么的,然后记录个数逆序输出就行。注意最后没有空格,用i判断是否达到最后一位。 1 #include <stdio.h> 2 #include <string.h> 3
阅读全文
浙公网安备 33010602011771号