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. Dijkstra经典算法注意点

    Dijkstra经典算法注意点 前言 迪杰斯特拉算法,经典模板如下: void dij(int s) { for(int i=1; i<=n; i++) dis[i]=road[s][i]; v ...

  2. 一篇包含了react所有基本点的文章

    去年,我写了一本关于学习React.js的小书,原来是大约100页. 今年我要挑战自己,把它归纳为一篇文章. 本文不会涵盖什么是React,或者为什么要学习它. 相反,这是面向已经熟悉JavaScri ...

  3. 在 linux 中 find 和 grep 的区别??

    Linux 系统中 grep 命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来.grep 全称是 Global Regular Expression Print,表示全局 ...

  4. AOS and clustering

    原文转载:http://sjakalax.blogspot.com/2010/10/aos-and-clustering.html AOS and clustering   hi,   There s ...

  5. centos7卸载YUM后重装过程 -bash: yum: command not found / -bash: yum: 未找到命令

    [root@localhost ~]# rpm -qa |grep yum yum-3.4.3-158.el7.centos.noarch yum-plugin-fastestmirror-1.1.3 ...

  6. hr员工数据分析(实战)

    hr员工数据分析项目实战 (数据已脱敏) 背景说明 某公司最近公司发生多起重要员工意外离职.部分员工工作缺乏积极性等问题,受hr部门委托,开展数据分析工作. 经与hr部门沟通,确定以下需求: 制定数据 ...

  7. 终于读完了《Essential C++》

    先说这本书的优点吧 真的是一本非常好的书 不拘泥于非常具体的语法点 读这本书,可以体会到面向对象的魅力所在. 缺点就是这本书不太适合入门,当初也不知道是谁推荐我入门看这本书的. 想要大致能看懂这本书, ...

  8. 转发一个robotframework的循环

    Click_Element Xpath=//b[text()='系统投放管理'] Sleep 1 Click_Element Xpath=//span[text()='全部投放情况查询'] Sleep ...

  9. php中判断数组键值,array_key_exists和isset区别

    $arr = array('key' => NULL); if(isset($arr['key'])){ echo 'isset'; } else { echo 'unset'; } echo ...

  10. CSS3 nth-of-type(n)选择器 last-of-type选择器 nth-last-of-type(n)选择器 CSS3 only-child选择器 only-of-type选择器

    CSS3 nth-of-type(n)选择器 “:nth-of-type(n)”选择器和“:nth-child(n)”选择器非常类似,不同的是它只计算父元素中指定的某种类型的子元素.当某个元素中的子元 ...