做为一名新手,首先要过一过题,找找成就感。(大佬略过)。下面附上洛古最简单50题(大佬略过)。以及最麻烦 AC代码,至少AC了。

目录·列表:

洛古最简单50题解(1-10)

洛古最简单50题解(11-20)

洛古最简单50题解(21-30)

洛古最简单50题解(31-40)

洛古最简单50题解(41-50)

NO.31 P1615 西游记公司

#include<iostream>
using namespace std;
int main()
{
    long long a1,a2,a3,s1,s2,s3,x,n;
    char m;
    cin>>a1>>m>>a2>>m>>a3>>s1>>m>>s2>>m>>s3>>x;
    n=((s1-a1)*3600+(s2-a2)*60+(s3-a3))*x;
    cout<<n;
}

NO.32 P1634 禽兽的传染病

#include<iostream>
using namespace std;
int main()
{
    long long n=1,x,y;
    cin>>x>>y;
    for (long long i=1;i<=y;i++)
    {
        n+=x*n;
    }
    cout<<n;
}

NO.33 P1720 月落乌啼算钱

#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
printf("%.2f",(pow(((1+sqrt(5))/2),n)-pow(((1-sqrt(5))/2),n))/sqrt(5));
return 0;
}

NO.34 P1760 通天之汉诺塔

#include<bits/stdc++.h>
using namespace std;
long long k=2,n;
#include<iostream>
using namespace std;
int a[15001];
int main()
{
int n;
a[1]=1;
cin>>n;
if(n==0)
a[1]=0;
for(int i=2;i<=n;i++)
{
for(int k=1;k<=i-1;k++)
a[k]*=2;
for(int k=1;k<=i-1;k++)
if(a[k]>=10)
{
a[k]-=10;
a[k+1]++;
}
a[1]++;
}
int p=15001;
while(a[p]==0&&p!=1)
{
p--;
}
for(int i=p;i>=1;i--)
cout<<a[i];
return 0;
}

NO.35 P1909 买铅笔

#include<iostream>
using namespace std;
int main()
{
    int a1,a2,a3,b1,b2,b3,n,t1,t2,t3;
    int d;
    cin>>n>>a1>>b1>>a2>>b2>>a3>>b3;
    t1=n/a1*b1;
    if (n%a1 != 0)
    {
        t1+=b1;
    }
    t2=n/a2*b2;
    if (n%a2 != 0)
    {
        t2+=b2;
    }
    t3=n/a3*b3;
    if (n%a3 != 0)
    {
        t3+=b3;
    }
    d=t1;
    if (d>t2)
    d=t2;
    if (d>t3)
    d=t3;
cout<<d<<endl;
    return 0;
}

NO.36 P1980 计数问题

#include<iostream>
using namespace std;
int main()
{
long long n,i,x,b,c,t=0;
cin>>n>>x;
for(i=1;i<=n;i++)
{
b=i;
while(b!=0)
{
c=b%10;
b=b/10;
if(c==x) t++;
}
}
cout<<t<<endl;
return 0;
}

NO.37 P2084 进制转换2

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    char a[1001];
    int b;
    scanf("%d ",&b);
    gets(a);
    for (int i=0;i<strlen(a);i++)
    {
        if(i!=0 && a[i] != '0')
        {
            cout<<"+";
        }
        if(a[i] == '0')
        {
            continue;
        }
        printf("%c*%d^%d",a[i],b,strlen(a)-i-1);
    }
    return 0;
}

NO.38 P2141 珠心算测验

#include<bits/stdc++.h>
using namespace std;
int n,s=0,a[101],f[20001];
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=i+1;j<n;j++)
            f[a[i]+a[j]]=1;
        for(int i=0;i<n;i++)
    if(f[a[i]]) s++;
    cout<<s;
}

NO.39 P2239 螺旋矩阵

#include<bits/stdc++.h>
using namespace std;
int jk(int n, int i, int j)
{
if (i == 1)
return j;
if (j == n)
return n + i - 1;
if (i == n)
return 3 * n - 2 - j + 1;
if (j == 1)
return 4 * n - 4 - i + 2;
return jk(n - 2, i - 1, j - 1) + 4 * (n - 1);
}
int main()
{
    int n,i1,j1;
    cin>>n>>i1>>j1;
/*
    if(i1>j1)
    {
        x=j1;
        x2=i1;
    }
    else
    {
        x=i1;
        x2=j1;
    }
    if(n % 2==0 && x2>n/2)
    {
        x=n/2-(x2-n/2)+1;
    }
    if(n % 2==1 && x2>=n/2+1)
    {
        x=n/2+1-(x2-(n/2+1));
    }
    int x3;
    x3=n-1;
    x2=4*x3;
    for(int i=n/2;i!=x;i--)
    {
        x2+=4*x3;    
        x3=n-2;
    }
    
    int i=x,j=x;
    t=0;
    while(i!=i1&&j!=j1)
    {
        t++;
        if(x3!=t)
        {
            i++;
        }
        else
        {
            t=0;
            if (i=x+x3+1&&j)
            {
                
            }
        }
    }

//    a[0]=x3+x+1;
//    a[1]=x3+x*2+1;
    int i=i1-x+1,j=j1-x+1;

    if(i==1||j==4)
    {
        t=i+j-1;
    }
    else
    {
        t=i+j-1+2*x3-i+j;
    }
    cout<<t+x2;
    /

*/
    cout<<jk(n,i1,j1);
}

NO.40 P2672 推销员

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define inf 100000
#define pr printf
#define sc scanf
#define ll long long
using namespace std;
struct S{
int a;
int s;
int c;
}st[inf+1];
int n;
ll ans;
bool cmp(S a,S b){
return a.a>b.a;
}
void swap(S &a,S &b){
S c;
c=a;a=b;b=c;
return;
}
int main(){
sc("%d",&n);
for(int i=1;i<=n;i++)sc("%d",&st[i].s);
for(int i=1;i<=n;i++)sc("%d",&st[i].a),st[i].c=i;

for(int j=1;j<=n;j++){
if(((st[1].s<<1)+st[1].a)<((st[j].s<<1)+st[j].a))swap(st[1],st[j]);
}
sort(st+2,st+n+1,cmp);
ans+=(st[1].s<<1);
for(int i=1;i<=n;i++){
if(st[i].s<=st[1].s)ans+=st[i].a;
else {
ans=ans+((st[i].s-st[1].s)<<1);
st[1].s=st[i].s;
ans+=st[i].a;
}
cout<<ans<<'\n';
}
return 0;
}//这题一点都不简单

转载于:https://www.cnblogs.com/aybengwa/p/11167708.html

洛古最简单50题解(31-40)相关推荐

  1. 洛古最简单50题解(1-10)

    做为一名新手,首先要过一过题,找找成就感.(大佬略过).下面附上洛古最简单50题(大佬略过).以及最麻烦 AC代码,至少AC了. 目录·列表: 洛古最简单50题解(1-10) 洛古最简单50题解(11 ...

  2. 洛古最简单50题解(41-50)

    做为一名新手,首先要过一过题,找找成就感.(大佬略过).下面附上洛古最简单50题(大佬略过).以及最麻烦 AC代码,至少AC了. 目录·列表: 洛古最简单50题解(1-10) 洛古最简单50题解(11 ...

  3. 洛古最简单50题解(21-30)

    做为一名新手,首先要过一过题,找找成就感.(大佬略过).下面附上洛古最简单50题(大佬略过).以及最麻烦 AC代码,至少AC了. 目录·列表: 洛古最简单50题解(1-10) 洛古最简单50题解(11 ...

  4. 洛古最简单50题解(11-20)

    做为一名新手,首先要过一过题,找找成就感.(大佬略过).下面附上洛古最简单50题(大佬略过).以及最麻烦 AC代码,至少AC了. 目录·列表: 洛古最简单50题解(1-10) 洛古最简单50题解(11 ...

  5. 【剑指Offer】俯视50题之31 - 40题

    [剑指Offer]俯视50题之31 - 40题 面试题31连续子数组的最大和 面试题32从1到n整数中1出现的次数 面试题33把数组排成最小的数 面试题34丑数 面试题35第一个仅仅出现一次的字符 面 ...

  6. 【洛谷P3960】列队题解

    [洛谷P3960]列队题解 题目链接 题意: Sylvia 是一个热爱学习的女孩子. 前段时间,Sylvia 参加了学校的军训.众所周知,军训的时候需要站方阵. Sylvia 所在的方阵中有 n×m ...

  7. 洛谷P2312 解方程题解

    洛谷P2312 解方程题解 题目描述 已知多项式方程: \[a_0+a_1x+a_2x^2+\cdots+a_nx^n=0\] 求这个方程在 \([1,m]\) 内的整数解(\(n\) 和 \(m\) ...

  8. 洛谷试炼场-简单数学问题-二分查找

    洛谷试炼场-简单数学问题 P1147 连续自然数和 题解: 本题给定一个数n,求连续自然数的和为n,用一个前缀数组,low_bound,upper_bound,查找是否是同一个数.O(nlog(n)) ...

  9. 洛谷P2507 [SCOI2008]配对 题解(dp+贪心)

    洛谷P2507 [SCOI2008]配对 题解(dp+贪心) 标签:题解 阅读体验:https://zybuluo.com/Junlier/note/1299251 链接题目地址:洛谷P2507 [S ...

最新文章

  1. 超详细!带输入输出的十五至尊图你见过吗?
  2. GBin1分享的10个吸引眼球的jQuery插件
  3. python安装无法打开_无法在打开时安装/运行docker
  4. PHP+Ajax点击加载更多列表数据实例
  5. 系统新模块增加需要哪些步骤_人工智能之父的问题解决策略:模块化
  6. 绝对位置,但相对于父位置
  7. python刚出来多少薪资-Python工资待遇的几个层级,你工作几年了?目前是哪个层级?...
  8. mysql_query 资源标识符_PHP mysql_query() 函数解析
  9. 图像处理之直方图均衡和直方图匹配
  10. springboot整合mybatis错误 Invalid bound statement (not found): 解决办法
  11. 陀螺仪数据转换成角度_MPU6050 计算角度
  12. 记录一下unity 加载外部视频
  13. vmbox设置ubuntu共享文件夹_为什么共享文件夹、打印机访问还是受限?这几个设置解决90%问题...
  14. 腾讯云TVP大数据之约活动归来
  15. 【Java】java.lang.Object
  16. 吴恩达深度学习课程完整笔记(DeepLearning.ai)
  17. 使用 Amazon SageMaker Clarify 解释德甲赛况 xGoals
  18. 安卓应用软件开发必学的基础内容
  19. android开发笔记之sh脚本
  20. k8s 拉取镜像失败_[k8s问题笔录] 记一次 kubectl 部署时,pull image 报错,拉取不到镜像...

热门文章

  1. 【Blog.Idp开源】支持在线密码找回
  2. 制作自己的Linux系统与启动光盘(1)
  3. IKAnalyzer介绍及使用
  4. The Big Bang Theory
  5. linux的回车和换行符,【Base】linux和windows下的“回车符”和“换行符”
  6. proxy代理配置 goproxy 代理配置
  7. OSCP学习笔记总结(本资料禁止转载)
  8. 如何快速提取PDF文件中的文字?
  9. jsconfig.json 在ts跟js混合的项目失效
  10. CPU加电后第一条指令