![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
洛谷题单暴力枚举
快乐平凡的小熙
此账号不再更新
展开
-
洛谷P1217[USACO1.5]回文质数 Prime Palindromes
#include<bits/stdc++.h> using namespace std; int arry[]={2,3,5,7,11,101,131,151,181,191,313,353,373,383,727,757,787,797,919,929,10301,10501,10601,11311,11411,12421,12721,12821,13331,13831,13931,14341,14741,15451,15551,16061,16361,16561,16661,17471,1.原创 2022-01-07 20:46:39 · 335 阅读 · 0 评论 -
洛谷P3654First Step (ファーストステップ)
#include<bits/stdc++.h> using namespace std; int n,m,r,ans; int nx[2]={0,1},ny[2]={1,0}; char mapp[100][100]; void dfs(int x,int y,int i,int step)//step表示处于第几层次,i来探究方向 { if(step>r) { ans++; return; } if(x>n||y>m||x<=0||y<=0||.原创 2022-01-07 20:45:02 · 584 阅读 · 0 评论 -
洛谷P3392 涂国旗
#include<bits/stdc++.h> using namespace std; int main() { int n,m,sum=0,minn=1e5; cin>>n>>m;//n是行数 char arry[n+1][m+1]; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin>>arry[i][j]; for(int i=1;i+2<=n;i++) {.原创 2022-01-07 20:42:02 · 508 阅读 · 0 评论 -
洛谷P1157 组合的输出
#include<bits/stdc++.h> using namespace std; const int N=21; int arry[N];bool book[N];int n,m; void dfs(int step) { if(step==m+1) { for(int i=1;i<=m;i++) printf("%3d",arry[i]); printf("\n"); return ; } for(int i=arry.原创 2022-01-07 20:28:26 · 422 阅读 · 0 评论 -
洛谷P1618 三连击(升级版)题解
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 一:代码部分 二:思路考点分析 #include<bits/stdc++.h> using namespace std; int A,B,C; int book[10]; int result(int a,int b,int c) { return 100*a+10*b+c; } int main() { cin>>A>>B>>C; int a[9],num,su原创 2022-01-07 20:20:03 · 394 阅读 · 0 评论 -
洛谷P2089烤鸡题解
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 代码部分 考点分析 #include<bits/stdc++.h> using namespace std; int book[100000][10];//行下标是8次位数 int main() { int n,sum=0;scanf("%d",&n); for(int a=1;a<=3;a++) for(int b=1;b<=3;b++) for(int原创 2022-01-07 20:14:52 · 375 阅读 · 0 评论 -
洛谷P2241统计方形(数据加强版)题解
#include<bits/stdc++.h> using namespace std; int main() { long long n,m,sum1=0,sum2=0; cin>>n>>m; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { sum1+=min(i,j);//推导猜出来的 } } sum2=(n*(n+1)/2)*(m*(m+1)/2)-sum1; cout..原创 2022-01-07 20:10:23 · 373 阅读 · 0 评论 -
函数prev_permutation和next_permutation的用法分辨
补充条件:m(arry存储)个里面选取n个。同时设置布尔数组(m个的) 以后统一设置前n个数组为1,用prev_permutation 例子:洛谷1249 #include<bits/stdc++.h> using namespace std; bool isnprimes[100000000];int primes[10000000];int cnt,sum;int count1; int k,n; void ola(int n) { for(int i=2;i<=n;i++)原创 2021-11-15 23:11:01 · 4729 阅读 · 0 评论 -
模拟分界线以及for循环的深刻理解
语法板块:①出现了只输入一行字符串便结束的景象。 1,原因分析:char给输入的时候直接二维数组开为了int #include<bits/stdc++.h> using namespace std; int min1=100000; int arry[100][100];int n,m,sum;//字符定义成为int int main() { cin>>n>>m; for(int i=1;i<=n;i++) for(int j=1;j<=原创 2021-10-30 00:25:07 · 132 阅读 · 0 评论