摘要: 1 //模拟题 2 #include 3 using namespace std; 4 char ma[250][250]; 5 int main() 6 { 7 int n; 8 scanf("%d",&n); 9 while(n--) 10 { 11 memset(ma,'.',sizeof(ma)); 12 ... 阅读全文
posted @ 2017-07-20 22:54 Kearon 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 int n; 4 char str1[110],str2[110]; 5 void b(char s[]) 6 { 7 int len=strlen(s); 8 for(int i=0;i='A'&&s[i]<='Z') 11 s[i]+=32; 12 if(s[i]=='... 阅读全文
posted @ 2017-07-20 22:53 Kearon 阅读(304) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 int main() 4 { 5 int n; 6 scanf("%d",&n); 7 while(n--) 8 { 9 int m,r; 10 int num,sum=0; 11 scanf("%d%d",&m,&r); 1... 阅读全文
posted @ 2017-07-20 22:52 Kearon 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 用1-9填满方格,每个数一次,相邻的数的位置也必须相邻 3 已经填好一些数,求填剩下数的方案数。 4 直接把剩下的数全排列,然后判断即可 5 */ 6 #include 7 using namespace std; 8 bool v[10]; 9 bool vis[5][5]; 10 char ma[5][5]; 11 int cop[5][5]; 12 int... 阅读全文
posted @ 2017-07-20 22:26 Kearon 阅读(318) 评论(0) 推荐(0) 编辑
摘要: 1 ///水题 2 #include 3 using namespace std; 4 int main() 5 { 6 int n; 7 int m; 8 int ans[110]; 9 scanf("%d",&n); 10 for(int i=0;i<n;i++) 11 for(int j=0;j<n;j++) 12... 阅读全文
posted @ 2017-07-20 22:25 Kearon 阅读(365) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 对于数组的每个元素,找到它右边的第一个比它大的元素 3 根据数组元素内容建立索引,有序记录a的每个值的所有出现的位置,然后对于每个a, 4 遍历所有大于a的可能的值,每个值用二分搜索找到当前位置右边的最小的出现位置, 5 (直接遍历会超时) 6 然后这些位置中取最小值即为结果所在的位置。 7 */ 8 #include 9 using namespace std... 阅读全文
posted @ 2017-07-20 22:24 Kearon 阅读(468) 评论(0) 推荐(0) 编辑
摘要: 1 ///水题 2 #include 3 using namespace std; 4 int main() 5 { 6 int n,m; 7 scanf("%d%d",&n,&m); 8 if(m%n==0) 9 printf("YES\n"); 10 else 11 printf("NO\n"); 12 } ... 阅读全文
posted @ 2017-07-20 22:23 Kearon 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 证书可以每次批量买a个,现在需要x个,问至少要买多少个。 3 把所有a排序,然后对于每个x二分搜索不小于x的最小的a,然后输出即可。 4 */ 5 #include 6 using namespace std; 7 const int maxn=1e5+5; 8 int n,a[maxn],m,x; 9 int main() 10 { 11 cin>>n... 阅读全文
posted @ 2017-07-20 22:22 Kearon 阅读(338) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 寻找x使得目标函数的值最小。 3 先统计字符串每个字母的出现次数,然后暴力穷举所有可能的x 4 每个都计算一次目标函数,取最小的即可。 5 */ 6 #include 7 using namespace std; 8 const int inf=0x3f3f3f3f; 9 string s; 10 int scnt[30]; 11 int main() 12... 阅读全文
posted @ 2017-07-20 22:21 Kearon 阅读(482) 评论(0) 推荐(0) 编辑
摘要: 1 ///水题 2 #include 3 using namespace std; 4 int main() 5 { 6 int n; 7 while(~scanf("%d",&n)) 8 { 9 char s[110]; 10 while(n--) 11 { 12 scanf("%... 阅读全文
posted @ 2017-07-20 22:19 Kearon 阅读(418) 评论(0) 推荐(0) 编辑