2015.10.09周赛
来源:互联网 发布:数据库抽取0或null 编辑:程序博客网 时间:2024/06/04 18:20
#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>#include <cstdlib>#include <set>#include <map>#include <queue>#include <stack>#include <cmath>#define LL long long#define M 1000000007#define INF 0x3f3f3f3f#define RR freopen("in,txt","r",stdin)#define WW freopen("out.txt","w",stdout)using namespace std;int main(){ int T; LL x,a; scanf("%d",&T); while(T--) { a=1; scanf("%lld",&x); for(int i=1;i<=x;i++) a=(a*i)%M; cout<<a-1<<endl; } return 0;}
#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>#include <cstdlib>#include <set>#include <map>#include <queue>#include <stack>#include <cmath>#define LL long long#define INF 0x3f3f3f3f#define RR freopen("in.txt","r",stdin)#define WW freopen("out.txt","w",stdout)using namespace std;const int maxn = 1000010;int dp[maxn],a[maxn];int main(){ int T,n; scanf("%d",&T); while(T--) { scanf("%d",&n); LL sum = 0; int pos = 0; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); sum += a[i]; } LL sum1 = 0; //min LL sum2 = 0; //max LL ant = 0; //res; LL ant1 = 0; for(int i=1;i<=n;i++) { sum1 += a[i]; if(sum1 > 0) { sum1 = 0; } ant1 = min(ant1,sum1); sum2 += a[i]; if(sum2 < 0) { sum2 = 0; } ant = max(ant,sum2); } ant = max(ant,sum-ant1); printf("%d\n",ant); } return 0;}
#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>#include <cstdlib>#include <set>#include <map>#include <queue>#include <stack>#include <cmath>#define LL long long#define INF 0x3f3f3f3f#define RR freopen("in,txt","r",stdin)#define WW freopen("out.txt","w",stdout)using namespace std;int main(){ int T; scanf("%d",&T); while(T--) { LL n,a,b; int cnt,pos; cin>>n>>a>>b; if(a % 2 || b % 2) { cout<<n<<endl; continue; } cnt=0;pos=0; for(int i=2;a%2==0;i++) a/=2,cnt++; for(int i=2;b%2==0;i*=2) b/=2,pos++; cout<<n-min(pos,cnt)<<endl; } return 0;}
#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>#include <cstdlib>#include <set>#include <map>#include <queue>#include <stack>#include <cmath>#define LL long long#define INF 0x3f3f3f3f#define RR freopen("in,txt","r",stdin)#define WW freopen("out.txt","w",stdout)using namespace std;const int maxn = 300;bool used[maxn];int g[maxn][maxn];int Link[maxn];int n,m,R;int dfs(int u){ for(int v=1; v<=m; v++) { if(g[u][v] && !used[v]) { used[v] = true; if(Link[v] == -1 || dfs(Link[v])) { Link[v] = u; return 1; } } } return 0;}int hungary(){ int ant = 0; for(int i=1; i<=n; ++i) { memset(used,false,sizeof(used)); ant += dfs(i); } return ant;}int main(){ int T; scanf("%d",&T); while(T--) { memset(g,false,sizeof(g)); memset(Link,-1,sizeof(Link)); scanf("%d%d%d",&n,&m,&R); double x,y; for(int i=0; i<R; i++) { scanf("%lf %lf",&x,&y); g[(int )x+1][(int )y+1] = true; } printf("%d\n",hungary()); } return 0;}
、
#include <cmath>#include <cstdio>#include <iostream>using namespace std;int main(){ int n,p,w,a,b,c; char name[200]; while(~scanf("%d %d",&n,&p)) { for(int i=0;i<n;i++) scanf("%d %s",&w,name); a=n/3; b=n-a*2; c=b-a; if(c==0||c==1) { if(p>a&&p<=n-a) printf("YES\n"); else printf("NO\n"); } else if(c==2) { if(p>a&&p<=n-a-1) printf("YES\n"); else printf("NO\n"); } } return 0;}
0 0
- 2015.10.09周赛
- 2015.10.09开博记录一下
- 周赛
- 周赛
- 周赛
- 周赛
- 周赛
- 周赛
- 周赛
- 周赛
- 周赛
- 周赛
- 周赛
- 周赛
- 周赛
- 周赛
- 2015.10.5
- 2015.10.9
- 第七周--项目二--建立链队算法库
- iOS开发系列--UITableView全面解析
- Python常用转换函数
- 获取系统权限的命令
- 为什么你有10年经验,但成不了专家?
- 2015.10.09周赛
- 第四周项目3单链表的应用(3)
- 【opencv2操作之HoughLinesP参数解释及实例展示】
- java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()
- navicat常用快捷键
- JSPservlet跳转页面404错误
- java中 sleep线程睡眠 Join线程独占 Yeile 线程让步 Interrupt线程中断 Deamon后台线程
- C++ 资源
- 第六周项目1-建立顺序栈算法库