codeforces #284
来源:互联网 发布:java ftp上传附件 编辑:程序博客网 时间:2024/06/07 17:44
<pre name="code" class="cpp">A.#include <iostream>#include <cstdio>using namespace std;#define maxn 55struct Time{ int L,R;}b[maxn];int main(){ int n,m; while(~scanf("%d%d",&n,&m)) { int cnt=0; for(int i=0; i<n; i++) { cin>>b[i].L>>b[i].R; } for(int i=0; i<n-1; i++) { int t=(b[i+1].L-b[i].R-1)/m; cnt+=t; } int t=(b[0].L-1)/m; cnt+=t; cout<<b[n-1].R-cnt*m<<endl; } cout<<endl; return 0;}
B.#include <iostream>#include <cstdio>#include <cstring>#include <map>using namespace std;int main(){ map<string, string> rep; string st1,st2; int n,m; while(~scanf("%d%d",&n,&m)) { for(int i=0; i<m; i++) { cin>>st1>>st2; rep[st1]=st2; } for(int i=0; i<n; i++) { cin>>st1; if(st1.length()>rep[st1].length()) cout<<rep[st1]; else cout<<st1; if(i<n-1) cout<<" "; } cout<<endl; } return 0;}
C.#include <iostream>#include <cstdio>#include <cstring>using namespace std;long long x1,y1,x2,y2;int main(){ cin>>x1>>y1; cin>>x2>>y2; long long n,a,b,c; cin>>n; int cnt=0; for(int i=0; i<n; i++) { long long temp1, temp2; cin>>a>>b>>c; temp1=a*x1+b*y1+c; temp2=a*x2+b*y2+c; if((temp1<0&&temp2>0)||(temp1>0&&temp2<0))//这样处理不会溢出 cnt++; } cout<<cnt<<endl; return 0;}
0 0
- codeforces #284
- 【codeforces】Codeforces Round #284 (Div. 1) 【题解】
- Codeforces Round #284 (Div2)
- Codeforces Round #284
- codeforces-div1-284-D
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- 用c语言写cgi程序(3)---实现文件上传
- Java学习--总结
- 悦卓iOS培训寒假篇—企业级C语言开发
- poj解题报告——2388
- 用c语言写cgi程序(1)
- codeforces #284
- Logstash 快速入门实例
- 多线程
- 用c语言写cgi程序(4)---处理请求post get。文本框,下拉列表框。
- 最大带权子树(hihocoder变种题)
- 嵌入式CGI开发之旅——2
- 超级宝典第三章剔除弃用的例子
- 内核裁剪
- 嵌入式CGI开发之旅——3