第一次AK的ABC

虽然题非常简单

但是值得纪念一下

T1

一道很水的题

不存在做法

纯粹乱跑

但是我把Yes打成YES了,哭唧唧

#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main(){
int a,b;
scanf("%d %d",&a,&b);
if((*a*b)%==||(*a*b)%==||(*a*b)%==)
printf("Yes\n");
else
printf("No\n");
return ;
}

T2

就是普通的判重和模拟

stl真好用

#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <iostream>
using namespace std;
int n;
set<string> s;
string a;
char lat;
int main(){
scanf("%d",&n);
for(int i=;i<=n;i++){
cin>>a;
if(s.count(a)){
printf("No\n");
return ;
}
if(i>&&a[]!=lat){
printf("No\n");
return ;
}
lat=a[a.length()-];
s.insert(a);
}
printf("Yes\n");
return ;
}

T3

有趣的GCD应用

秒掉

#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
using namespace std;
int n,x,pos[];
int gcd(int a,int b){
return (b==)?a:gcd(b,a%b);
}
signed main(){
scanf("%lld %lld",&n,&x);
for(int i=;i<=n;i++)
scanf("%lld",&pos[i]);
for(int i=;i<=n;i++)
pos[i]-=x;
++n;
pos[n]=;
sort(pos+,pos+n+);
int ans=pos[]-pos[];
for(int i=;i<=n-;i++){
ans=gcd(ans,pos[i+]-pos[i]);
}
printf("%lld",ans);
return ;
}

T4

乍一看不好做其实很水的构造

#include <cstdio>
#include <algorithm>
#include <cstring>
#define int long long
using namespace std;
int mat[][],mat2[][],ans=;
int h,w;
signed main(){
scanf("%lld %lld",&h,&w);
for(int i=;i<=h;i++)
for(int j=;j<=w;j++)
scanf("%lld",&mat[i][j]),mat2[i][j]=mat[i][j];
for(int i=;i<=h;i++)
for(int j=;j<=w-;j++){
if(mat2[i][j]%==)
continue;
else{
ans++;
mat2[i][j+]++;
mat2[i][j]--;
}
//ans+=mat2[i][j],mat2[i][j+1]+=mat2[i][j],mat2[i][j]=0;
}
for(int i=;i<=h-;i++){
//ans+=mat2[i][w],mat2[i+1][w]+=mat2[i][w],mat2[i][w]=0;
if(mat2[i][w]%==)
continue;
else{
ans++;
mat2[i+][w]++;
mat2[i][w]--;
}
}
printf("%lld\n",ans);
for(int j=;j<=h;j++)
for(int i=;i<=w-;i++){
if(mat[j][i]%==)
continue;
else{
printf("%lld %lld %lld %lld\n",j,i,j,i+);
mat[j][i+]++;
mat[j][i]--;
}
// for(int k=1;k<=mat[j][i];k++){
// printf("%d %d %d %d\n",j,i,j,i+1);
// mat[j][i+1]+=1;
// }
// mat[j][i]=0;
}
for(int i=;i<=h-;i++){
if(mat[i][w]%==)
continue;
else{
mat[i+][w]++;
mat[i][w]--;
printf("%lld %lld %lld %lld\n",i,w,i+,w);
}
}
// for(int k=1;k<=mat[i][w];k++)
// printf("%d %d %d %d\n",i,w,i+1,w),mat[i+1][w]++;
return ;
}

最新文章

  1. 如何通过源生js获取一个元素的具体样式值 /* getCss:获取指定元素的具体样式的属性值 curElement:[dom对象] attr:[string] */
  2. 在移动端中的flex布局
  3. C++学习笔记(1)
  4. TodoMVC中的Backbone+MarionetteJS+RequireJS例子源码分析之三 Views
  5. Word有用的快捷键
  6. 重启redis报错:Waiting for Redis to shutdown
  7. [转载] 首席工程师揭秘:LinkedIn大数据后台是如何运作的?(一)
  8. vim之pydiction插件
  9. 测试Tomcat
  10. dataguard 日志传输服务
  11. javascript--”原路返回“
  12. struts2,hibernate,spring整合笔记(1)
  13. php环境和apache服务启动不的解决方法
  14. Flume - Kafka日志平台整合
  15. redis.conf常用配置说明
  16. Winform开发中对界面的组织布局
  17. gcc:call to &#39;__open_missing_mode&#39; declared with attribute error
  18. Eclipse中如何打开Map/Reduce Locations窗口
  19. Git -- 忽略特殊文件
  20. iterator not dereferencable问题

热门文章

  1. Yii Restful api自定义字段
  2. C#操作XML方法详解
  3. 20165305 实验三 敏捷开发与XP实践
  4. flask 单个页面多个表单(单视图处理、多视图处理)
  5. RPC框架小结
  6. mac电脑复制粘贴使用command+c command+v
  7. There is no session with id XXX
  8. byte &amp; 0xff char 转换
  9. AJAX异步请求,局部刷新
  10. 面试必问之JVM篇