1001 Flooded Island

http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=4521

把陆地四面其中三面被海洋环绕的‘@’标记。

 #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
char ma[][];
int dir[][]={-,,,,,-,,};
int main()
{
memset(ma,'.',sizeof(ma));
int n,m;scanf("%d%d",&n,&m);
for(int i=;i<=n;i++)
{
getchar();
for(int j=;j<=m;j++)
scanf("%c",&ma[i][j]);
}
int mini=,maxi=-,minj=,maxj=-;
for(int i=;i<=n;i++)
for(int j=;j<=m;j++)
{
int cnt=;
if(ma[i][j]=='X')
{
for(int k=;k<;k++)
{
int nowi=i+dir[k][],nowj=j+dir[k][];
if(ma[nowi][nowj]=='.') cnt++;
}
if(cnt>=) ma[i][j]='@';
}
if(ma[i][j]=='X')
{
mini=min(mini,i);
maxi=max(maxi,i);
minj=min(minj,j);
maxj=max(maxj,j);
}
}
//printf("%d %d %d %d\n",mini,maxi,minj,maxj);
for(int i=mini;i<=maxi;i++)
{
for(int j=minj;j<=maxj;j++)
printf("%c",ma[i][j]=='X'?'X':'.');
printf("\n");
}
}

1002 Buy Tickets

http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6018

线段树,我先跑了

1003 Strange fuction

http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6052

F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100),给一个y解出F(x)min(x∈[0,100])

求导,二分。

 #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
double f(double x,double y)
{
return *pow(x,6.0)+*pow(x,5.0)+*pow(x,2.0)+*x-y;
}
double ans(double x,double y)
{
return *pow(x,7.0)+*pow(x,6.0)+*pow(x,3.0)+*x*x-y*x;
}
int main()
{
int t;scanf("%d",&t);
while(t--)
{
double y;scanf("%lf",&y);
double mid,left=0.0,right=100.0;
while(right-left>1e-)
{
mid=(left+right)/2.0;
if(f(mid,y)<1e-) left=mid;
else right=mid;
}
printf("%.4f\n",ans(mid,y));
}
}

太难了。自动忽略1004。

1005 A sequence of numbers

http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6063

看a、b、c是等差数列还是等比数列,然后算第k个。等差数列没话说,等比数列快速幂,注意mod

 #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=;
ll f(ll a,ll b)
{
ll res=;
while(b)
{
if(b&) res=(res*a)%mod;
b>>=;
a=(a*a)%mod;
}
return res;
}
int main()
{
int t;scanf("%d",&t);
while(t--)
{
ll a,b,c,k,ans;scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
if((a+c)==*b)
{
ll d=(b-a)%mod;
ans=(d*(k-)+a)%mod;
}
else{
ll q=(b/a)%mod;
ans=(f(q,k-)*a%mod)%mod;
}
printf("%lld\n",ans);
}
}

1006 GCD

http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6066

求满足__gcd(i,n)>=k的i的个数,将满足的因子欧拉函数累加

 #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int Eular(int n)
{
int res=n;
for(int i=;i*i<=n;i++)
if(n%i==)
{
res-=res/i;
while(n%i==) n/=i;
}
if(n>) res-=res/n;
return res;
}
int main()
{
int t;scanf("%d",&t);
while(t--)
{
ll ans=;
int i,n,k;scanf("%d%d",&n,&k);
for(i=;i*i<n;i++)
{
if(n%i==)
{
if(i>=k) ans+=Eular(n/i);
if(n/i>=k) ans+=Eular(i);
}
}
if(i*i==n&&i>=k) ans+=Eular(i);
printf("%lld\n",ans);
}
}

1007 Following Orders

http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=6080

我又双叒叕跑了

1008 ST Task

角速度v来转这个杆子,第i秒的影子Lcos(v*PI/180.0*i),注意向下取整。

http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=2632

 #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PI acos(-1)
int main()
{
int l,v;scanf("%d%d",&l,&v);
for(int i=;i<=/v;i++)
{
double l1=abs(l*cos(v*PI/180.0*i));
int ll=(int)(l1+0.5);
if(v*i<=)
{
for(int j=l-ll;j>=;j--) printf("S");
for(int j=ll;j>=;j--) printf("T");
for(int j=;j<l;j++) printf("S");
printf(" %.5f\n",l1*1.0/l*1.0/2.0);
}
else{
for(int j=;j<l;j++) printf("S");
for(int j=ll;j>=;j--) printf("T");
for(int j=l-ll;j>=;j--) printf("S");
printf(" %.5f\n",l1*1.0/l*1.0/2.0);
}
}
}

2019/10/26 TZOJ的更多相关文章

  1. 2019.10.26 CSP%您赛第三场

    \(CSP\)凉心模拟^_^ --题源\(lqx.lhc\)等各位蒟蒻 题目名称 比赛 传递消息 开关灯 源文件名 \(competition.cpp\) \(message.cpp\) \(ligh ...

  2. 2019/10/27 TZOJ

    1001 Gaussian Prime http://www.tzcoder.cn/acmhome/problemdetail.do?&method=showdetail&id=379 ...

  3. 6392. 【NOIP2019模拟2019.10.26】僵尸

    题目描述 题解 吼题但题解怎么这么迷 考虑一种和题解不同的做法(理解) 先把僵尸离散化,h相同的钦(ying)点一个大小 (可以发现这样每种情况只会被算正好一次) 计算完全被占领的方案,然后1-方案/ ...

  4. 6389. 【NOIP2019模拟2019.10.26】小w学图论

    题目描述 题解 之前做过一次 假设图建好了,设g[i]表示i->j(i<j)的个数 那么ans=∏(n-g[i]),因为连出去的必定会构成一个完全图,颜色互不相同 从n~1染色,点i的方案 ...

  5. 2019/10/13 TZOJ

    水题虽不好,但是很爽 渴望未来某天能把剩下的题补了,先做个记录. Hard Disk Drive http://acm.hdu.edu.cn/showproblem.php?pid=4788 单位转化 ...

  6. 2019.10.26 csp-s模拟测试88 反思总结

    今天的主人公是什么? 60.1K!!!! 先扔代码再更新防止我等会儿一上头不打算写完题解 T1: #include<iostream> #include<cstdio> #in ...

  7. Alpha冲刺(3/10)——2019.4.26

    所属课程 软件工程1916|W(福州大学) 作业要求 Alpha冲刺(3/10)--2019.4.26 团队名称 待就业六人组 1.团队信息 团队名称:待就业六人组 团队描述:同舟共济扬帆起,乘风破浪 ...

  8. Beta冲刺(5/7)——2019.5.26

    所属课程 软件工程1916|W(福州大学) 作业要求 Beta冲刺(5/7)--2019.5.26 团队名称 待就业六人组 1.团队信息 团队名称:待就业六人组 团队描述:同舟共济扬帆起,乘风破浪万里 ...

  9. 背水一战 Windows 10 (26) - XAML: x:DeferLoadStrategy, x:Null

    [源码下载] 背水一战 Windows 10 (26) - XAML: x:DeferLoadStrategy, x:Null 作者:webabcd 介绍背水一战 Windows 10 之 XAML ...

随机推荐

  1. VINS 估计器之外参初始化

    为何初始化外参 当外参完全不知道的时候,VINS也可以在线对其进行估计(rotation),先在processImage内进行初步估计,然后在后续优化时,会在optimize函数中再次优化. 如何初始 ...

  2. org.hibernate.hql.ast.QuerySyntaxException: tb_voteoption is not mapped [from tb_voteoption where voteID=?]

    转自:https://www.cnblogs.com/albert1017/archive/2012/08/25/2656873.html org.hibernate.hql.ast.QuerySyn ...

  3. 自定义、操作cookie

    /** * 读取所有cookie * 注意二.从客户端读取Cookie时,包括maxAge在内的其他属性都是不可读的,也不会被提交.浏览器提交Cookie时只会提交name与value属性.maxAg ...

  4. int型、char*、string、的swap算法

    1.俩整数,不使用中间变量交换其值: int& intswap(int& a, int& b) { b ^= a; a ^= b; b ^= a; return b; } 2. ...

  5. uboot中Kconfig架构的理解

    1./u-boot-2019.07/Kconfig 是顶层Kconfig mainmenu "U-Boot $UBOOTVERSION Configuration"  #这是总me ...

  6. Ts 的类

    TS 中的公共.私有和受保护的修饰符: 1.public表示公共的,用来指定在创建实例后可以通过实例访问的,也就是类定义的外部可以访问的属性和方法.默认是 public 2.private修饰符表示私 ...

  7. windowserver 常用命令

    1.查看端口占用: netstat -ano | findstr "服务端口号"2.查看程序运行id: tasklist | findstr  nginx 3.杀死进程  tskk ...

  8. 阿里云ECS无法通过SSL远程链接问题。

    自己配置的SSL,通过密码,公司的是通过密钥,结果也是一样, 环境:centos7.x 网络: 家里宽带 公司网络 省图书馆wifi 家里宽带,公司网络均可以链接上去, 但唯独省图书馆wifi链接失败 ...

  9. RestTemplate 发送post请求

    springboot使用restTemplate post提交值 restTemplate post值 post提交有 FormData和Payload 两种形式: 第一种是formdata形式,在h ...

  10. plafrom SDK

    { //http://www.alipay-seller.mpymnt.com/node/82 //https://blog.csdn.net/xiaopingping1234567/article/ ...