
ACM-水题
文章平均质量分 61
但求-_-心安
充满鲜花的世界到底在那里,如果他真的存在那么我一定会去。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu 6130 Kolakoski (水题)
#include#include#include#include #include #include #include #include #include using namespace std;int a[10000009];int b[10000009];int sum[10000009];void init(){ a[1]=1; a[2]=2;原创 2017-08-16 09:39:32 · 384 阅读 · 0 评论 -
51nod 1058 N的阶乘的长度
还有这个公式?1*2*3*4的位数为log10(1)+log10(2)+log10(3)+log10(4),转化为整形再加上 1#include using namespace std;int main(){double n;scanf("%lf",&n);double ans=0;for(int i=1;i<=n;i++) ans+=log10(i);int k=a原创 2017-10-12 19:24:25 · 248 阅读 · 0 评论 -
2017 icpc亚洲区预赛西安站 J LOL
比赛时候容斥,,然而没出来开始享用容斥原理来做,思路是这样的。先把每个人可以选的英雄枚举出来b[0]——b[4],乘起来是全集,设这5个人分别为a,b,c,d,e.如果令a1=a∩b,a1*c*d*e就是a和b重复的个数。以此类推奇加偶减,然而并不对,直接被我推翻了,好像是中间重复减的不正确,我也不知道怎么容斥,天才卡题少女队员提了下自己是容斥,然而只提了这么多。。。。弱菜表示并不会。原创 2017-10-31 18:48:14 · 729 阅读 · 0 评论 -
Codeforces Round #442 (Div. 2) C. Slava and tanks
陷入了靠前焦虑状态,好长时间没做过题了吧,水题一个没想起来。。-------------------因为热爱,所以执着-----------------继续补题,不急慢慢来。#includeusing namespace std;#define pb push_back#define mp make_pairchar s[5005];int dp[50原创 2017-10-24 18:51:09 · 277 阅读 · 0 评论 -
ZOJ 3985 String of CCPC (字符串判断)
很水的其实,开始在看最后一题,没想做这个,或者说开始想的太复杂。也不能证明正确性,就放下了#include #include #include #include #include using namespace std;const int N=2e5+20;char s[N];int main(){ int t; //ios::sync_with_stdio(原创 2017-11-01 21:55:36 · 786 阅读 · 0 评论 -
codeforces 883 F. Lost in Transliteration
这是一个大水题,为什么要写他呢,因为我用错了一个string的方法,写下来提醒下自己。string 如果定义了s=“”;那么s就是等于空了,如果想加入值 s+=“1”,如果直接写s[0]=‘1’;就等于没写#includeusing namespace std;mapmp;int main(){int n,ans=0;cin>>n;string s,s1,s2;while原创 2017-10-25 17:46:57 · 415 阅读 · 0 评论 -
Codeforces 888B Buggy Robot (模拟)
#include #include #include #include #include #include void run(std::istream &in, std::ostream &out) { int n; in >> n; std::string s; in >> s; int x = 0; int y = 0; f原创 2017-11-13 20:34:54 · 418 阅读 · 0 评论 -
Wannafly模拟赛5 A Split
不小心找到了规律,惭愧惭愧#include #include #include #include using namespace std; int main(){ int n,m; scanf("%d%d",&n,&m); if(n*(n-1)/2<m) { printf("-1\n"); return 0;原创 2017-11-03 21:37:51 · 277 阅读 · 0 评论 -
Wannafly模拟赛5 D Aria
抠脚了开始,练next_permutataion()都不会用了,差点就手打出来了。。。抠脚了#include #include #include #include using namespace std;int maxn=0,n,a[6];void dfs(int tmp,int cnt){ maxn=max(maxn,tmp); if(cnt>=n)return原创 2017-11-03 21:43:31 · 313 阅读 · 0 评论 -
Codeforces Round #464 (Div. 2)C. Convenient For Everybody
简单的尺取法吧,昨天心态玩到爆炸,时区搞不准。。无奈自我退战了一波。#includeusing namespace std;#define pb push_back#define mp make_pairint a[100005];int main(){int n;scanf("%d",&n);for(int i=1;i<n;i++) scanf("%d",&a[原创 2018-02-18 10:33:51 · 411 阅读 · 0 评论 -
“浪潮杯”山东省第八届ACM大学生程序设计竞赛 sum of power
#include using namespace std;int mod=1e9+7;int main(){int n,m;scanf("%d%d",&n,&m);long long ans=0;for(int i=1;i<=n;i++){ long long tmp=1; for(int j=1;j<=m;j++) tmp*=i,tmp%=mod原创 2018-04-24 17:45:08 · 430 阅读 · 0 评论 -
“浪潮杯”山东省第八届ACM大学生程序设计竞赛 company
sort排序#include <bits/stdc++.h>using namespace std;int mod=1e9+7;long long ans;struct node{ long long val,cnt;}a[1005];bool cmp(node b,node c){ return b.val>c.val;}int main()...原创 2018-04-24 19:16:59 · 332 阅读 · 0 评论 -
51nod 1057 N的阶乘 (水题ing……)
#includeusing namespace std;const int maxn=1e8;int main(){int n;long long a[10000];scanf("%d",&n);int m=0;a[0]=1;for(int i=1;i<=n;i++){ int c=0; for(int j=0;j<=m;j++) {原创 2017-10-19 20:00:34 · 404 阅读 · 0 评论 -
51nod 1181 质数中的质数(质数筛法)
质数筛法#include using namespace std;typedef long long ll;const int N=1e6+10000;int vis[N]={0},prime[N],prime1[N],cnt=0,cnt1=0;void init(){ for(int i=2;i<N;i++) { if(vis[i]==0)原创 2017-10-10 17:33:07 · 218 阅读 · 0 评论 -
51nod 1006 最长公共子序列Lcs
#includeusing namespace std;//以下为倍增算法求后缀数组int dp[1100][1100];char s[1100],s1[1100],s2[1100];int main(){ cin>>s; cin>>s1; int len1=strlen(s); int len2=strlen(s1); memset(dp,0,sizeof(dp)); f原创 2017-10-02 16:50:19 · 255 阅读 · 0 评论 -
hdu 6152 Friend-Graph
3个人互相是朋友或者不是朋友就输出bad 。。。第一行如果3个1,肯定是bad 稍微推一下就知道,下面的会互相矛盾。5以内的三重循环暴力一下。#include #include #include using namespace std;int main(){ int t,a[6][6]; scanf("%d",&t); while(t--) {原创 2017-08-21 15:15:12 · 288 阅读 · 0 评论 -
hdu 6154 CaoHaha's staff
规律题每增加4条边有个规律,注意用Long long#include #include #include #include #include using namespace std;int main(){ int t; scanf("%d",&t); while(t--) { int n; long long an原创 2017-08-21 15:17:05 · 218 阅读 · 0 评论 -
Kirill And The Game
#includeusing namespace std;typedef long long ll;int main(){ long long l,r,x,y,k; while(~scanf("%I64d%I64d%I64d%I64d%I64d",&x,&y,&l,&r,&k)) { int flag=0; for(int i=l;i<=r;i++)原创 2017-08-30 19:38:20 · 429 阅读 · 0 评论 -
Gleb And Pizza
#includeusing namespace std;typedef long long ll;int main(){ double r,d,n,x,y,R,d1;while(cin>>r>>d>>n){ d=r-d; int cnt=0; for(int i=1;i<=n;i++){scanf("%lf%lf%lf",&x,&y,&R);d1=sqr原创 2017-08-30 19:38:57 · 296 阅读 · 0 评论 -
Codeforces Round #436 (Div. 2) Make a Permutation!
#include #define pb push_back#define mp make_pairusing namespace std;int a[200005];int vis[200005];//记录访问过几次bool vis1[200005];//记录是不是访问过int main(){ int n; scanf("%d",&n); memset(v原创 2017-09-26 17:04:53 · 234 阅读 · 0 评论 -
Codeforces Round #436 (Div. 2)Bus
有很多同学可能比较迷。#include #define pb push_back#define mp make_pairusing namespace std;int a[28];char s[300];int main(){ int a,b,f,k; scanf("%d%d%d%d",&a,&b,&f,&k); int cnt=0; int now原创 2017-09-26 17:07:23 · 263 阅读 · 0 评论 -
Codeforces Round #434 k-rounding
水题#include using namespace std;#define pb() push_back()long long gcd(long long a,long long b){ if(b==0)return a; else return gcd(b,a%b);}const int maxn=10;int main(){// freopen("tes原创 2017-09-19 15:53:12 · 349 阅读 · 0 评论 -
Codeforces Round #434 Which floor?
暴力几个单元一层,看给出的数在几层,是不是有多种可能,没有输出在几层,有输出-1#include using namespace std;#define pb() push_back()int a[105],b[105];int main(){// freopen("test.in","r",stdin);int n,m;scanf("%d%d",&n,&m);int max原创 2017-09-19 15:54:12 · 437 阅读 · 0 评论 -
51nod 1732 51nod婚姻介绍所
气死了,c++提交就超时,把#include换成了#include就过了。。。。气死了,我还优化了半小时。。。。你告诉我换个头文件用c语言提交?#include int n;int dp[1005][1005];char s[1005];void init(){ //memset(dp,0,sizeof(dp)); dp[0][0]=n; for(int i=n-1;i原创 2017-09-03 10:43:01 · 227 阅读 · 0 评论 -
Codeforces Round #437 (Div. 2, based on MemSQL Start[c]UP 3.0 - Round 2) B - Save the problem!
特判就行了,用1,2来特判#include using namespace std;#define pb() push_back()#define mp make_pairconst int maxn=10;int main(){ //freopen("test.in","r",stdin);int n;cin>>n;if(n==1){ printf("1 1\原创 2017-10-01 10:38:45 · 375 阅读 · 0 评论 -
Codeforces Round #437 (Div. 2, based on MemSQL Start[c]UP 3.0 - Round 2) C - Ordering Pizza
都选最优的,最多会多出一盒饼,然后减去最少的就行了#include using namespace std;#define pb push_back#define mp make_pairconst int maxn=1e5+9;vector >aa,bb;bool cmp(pair a, pair b){ return a.first<b.first;}long l原创 2017-10-01 10:42:45 · 317 阅读 · 0 评论 -
“浪潮杯”山东省第八届ACM大学生程序设计竞赛Parity check (大数)
import java.math.BigInteger;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while(in.hasNext原创 2018-04-24 19:35:17 · 253 阅读 · 0 评论