C语言竞赛初级组第一、二场答案:https://www.cnblogs.com/xingkongyihao/p/10046918.html 

A: 逆序对

时间限制: 1 s      内存限制: 128 MB 

题目描述

1.整数序列中两个相邻的数,如果后面的数小于前面的数,则称这两个数值构成了一个逆序对。例如,整数序列10,4,16,8,21,18,9中包含了4个逆序对。从键盘上输入n个由空格分隔的整数,编程输出其中包含的逆序对的数量。

输入

第一行输入一个数字n (1≤n≤1000)

第二行输入n个由空格分隔的整数

输出

输出一个数字,表示逆序对的答案

样例输入

7
10 4 16 8 21 18 9

样例输出

4

果然就是比较相邻么
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices; public class Program
{
public static void Main()
{
int cunt = 0;
int n = ri();
List<int> a = new List<string>(Console.ReadLine().Split()).ConvertAll(i => int.Parse(i));
for (int i = 1; i < n; i++)
{
if (a[i] < a[i - 1])
{
cunt++;
}
} Console.WriteLine(cunt);
Console.ReadKey();
} public static int ri() { return int.Parse(Console.ReadLine()); }
static int[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e =>int.Parse(e)); }
}

B: sky的圈圈

时间限制: 1 s      内存限制: 128 MB     

题目描述

最近小S不高兴了,所以她就想画圈圈,有大有小的。而现在她想让你也画圈圈了^_^。

大小为3的圈圈是aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABhCAIAAACvTZOwAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA51JREFUeF7tmzF200AYhNecJaHI4wTSCQxNbkBnXcIlHY1cms4tFQ3yCeAEfiki30WsFAuHvJX0jzRa5Pdmm4R4NLv/l1lb6M+uqqpyGjYC72wyqWoCggXkQLAECyAASJUswQIIAFIlS7AAAoBUyRIsgAAgVbIECyAASJnJOmar7Ng793mXpruzc7u0TznsAxTIlDJh+XWdnj2K7lE+/XbuznlN8nDfJxzwYRIAvMiw+mc+P5/ch/fONcxucEyH5TfNapWmaZb9ODn3/Wvmv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ORixJG8UdLysYwdLLlKN667681iB0suqVMsYwdLrlKnWMYOllyMOKIPUmn54K/MnxBJUbjzhtmWTqFT6BRMAToF04lrirZT8vEFEk0gGCQGwVyAoEqdonD6QjUqQeacxZSKkiZAogkEk52GLkAgyjzRhPw0iK4goTeBKMqnL4pPg+iLIv6Pa/8NXvyiqttNTbVoAogvIK6C7fHbSwXlE+w6y+mLgqhEuYQUBeYXVSFiIqcvEAzCpYkRlg9kVySaQDAQmSZoTlGGcSIxCILRnHeyrzlFQaIJBGMmxkA0pyieA4kmEIytLjzFob11YHv/7NhmLh+7iWgyURSWD+YnOoVOoVMwBegUTCeuKXQKnYIpQKdgOnFNoVMwp7wDVUogghlhgREAAAAASUVORK5CYII=" alt="" />,大小为5的圈圈是aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH8AAACOCAIAAACXEUD4AAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOxAAADsQBlSsOGwAABd1JREFUeF7tnTF620YUhJc5i51CX05AnoCudAN34iV0gzRUSXdsU6Uib+AT8Eth6C7wAiBjUgawA3EWs3EGjWxjvO/t/x5WEHcELOq6Dj5EBH4TxXXYhoDpK/vA9E1fSUAZ271v+koCytjufdNXElDGdu+bvpKAMrZ73/SVBJSx3fumrySgjO3eN30lAWVs977pKwkoY7v3TV9JQBk7S+8fN4vNcXRWry+r1ctrCC+rYSVLE0I6H1EJstCPczl9i2yHj+qfryF8CFGzfPg4IGNp2uET+fxi9Men8/rtFP74PYQW8MDB0ojAQmGJvR+v78VitVptNn+fQvjrz038c/yXkTWoA/xhfI16t2Z6PhAxpohIf72r62q/f358iAnGnn583u+rut6tf8439vx5xRldeO7TTMiHSXTSWNHLRj6q7bLN4OnQM/D53NsUb7QszTn8aD7kuU8cLkzUJ+WHp457+zW2fu8R+Z41y+3QiCQNlE9yVpkExJWn6efj5tNpWzWLzXq3XX753NxVjh7N997UcYdmcj6pXMjnM1V1YNimE3uOmyuApZl3Zu+KRl95kCwi3+W2qpsF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Pi838c32ux63qDe/ibhx2YK5y89s7lbMyEfEszpw/D30u52eSDOFESDuE74058yInFXvQuLvK0GehMN4ExBxoHymUKMqSWuPM11d9x8Om2rZrFZ77bLL59fXhNXY7P1kTru0EzOJ5UL+TyzlOmxEJcHS5PORq6grzzIjJA347A0SD4yDXnlgS5MxOXB0kAJyUQK+pfJIs8NYWlkgEcDK+gjzw1hacqkfslKQT/GRlweLE3BBfAzSpTFEfW+csoFxTZ9ZTFM3/SVBJSx3fumrySgjO3eN30lAWVs977pKwkoY7v3TV9JQBnbvW/6SgLK2N8BTB/r49pp7+EAAAAASUVORK5CYII=" alt="" />,依次类推。

输入

输入一个数字n (3≤n≤100)

输出

输出你画的圈圈。

样例输入

3

样例输出

*#*
#*#
*#* 画图画图。。
using System;
using System.IO;
using System.Linq; public class Program
{
public static void Main()
{
var n = ri();
char[,] Map = new char[200,200];
Map[0, 0] = '*';
Map[0, n - 1] = '*';
Map[n - 1, 0] = '*';
Map[n - 1, n - 1] = '*'; for (int i = 1; i < n-1; i++)
{
Map[0, i] = '#';
Map[n - 1, i] = '#';
}
for (int i = 1; i < n - 1; i++)
{
Map[i, 0] = '#';
Map[i, n-1] = '#';
}
for (int i = 1; i < n - 1; i++)
{
for (int j = 1; j < n - 1; j++)
{
Map[i, j] = '*';
}
} for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
Console.Write(Map[i,j]);
} Console.WriteLine();
} Console.ReadKey();
}
public static int ri() { return int.Parse(Console.ReadLine()); }
static int[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e =>int.Parse(e)); }
}

C: 找零钱

时间限制: 1 s      内存限制: 128 MB    

题目描述

小明现在有x元,现在想买一件y (y≤x)元的物品,商店里有五种货币,100元、20元、10元、5元、1元无限张,服务员会以最小的数量找零钱。问小明用x元买了一件y元的物品后找了多少张零钱。

输入

输入x和y两个整数(1≤y≤x≤10000)

输出

输出找零钱的最小的数量

样例输入

101 66

样例输出

3

提示

用101元买了一件66元的物品,需要找35元,一张20元、一张10元和一张5元。

贪心,取模取模取模

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices; public class Program
{
public static void Main()
{
int cunt;
int result = 0;
List<int> a = new List<string>(Console.ReadLine().Split()).ConvertAll(i => int.Parse(i)); cunt = a[0] - a[1];
result += cunt / 100;
cunt %= 100;
result += cunt / 20;
cunt %= 20;
result += cunt / 10;
cunt %= 10;
result += cunt/5;
cunt %= 5;
result += cunt / 1;
Console.WriteLine(result);
Console.ReadKey();
} public static int ri() { return int.Parse(Console.ReadLine()); }
static int[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e =>int.Parse(e)); }
}

D: 编程语言

时间限制: 1 s      内存限制: 128 MB  

题目描述

现在的编程越来越多了,比如C、C++、Java、Python、C#、PHP等等。现在给定n种编程语言,每种语言还会给一个[1,n]之间的随机值,保证不重复。现在让你按随机值从小到大排序,然后输出对应的语言。

输入

第一行输入一个整数n (1≤n≤20)

接下来nn行,每行有一个字符串和一个随机值,字符串表示一种语言,长度不超过20.随机值范围为[1,n]

输出

输出nn行,按随机值从小到大输出对应的语言

样例输入

4
Java 3
C 1
Python 4
C++ 2

样例输出

C
C++
Java
Python 排序排序排序排序
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices; public class Program
{
public static void Main()
{
var n = ri(); ArrayList al = new ArrayList();
for (int i = 0; i < n; i++)
{
Language La = new Language();
var x = Console.ReadLine().Split();
La.xx = x[0];
La.yy = int.Parse(x[1]);
al.Add(La);
}
Languagex languagex = new Languagex();
al.Sort(languagex);
Language Laa = new Language();
for (int i = 0; i < n; i++)
{
Laa = (Language) al[i];
Console.WriteLine(Laa.xx);
} Console.ReadKey();
} public class Language
{
public string xx;
public int yy;
}
public class Languagex:IComparer
{
public int Compare(object x, object y)
{
return ((Language) x).yy.CompareTo(((Language) y).yy);
}
}
public static int ri() { return int.Parse(Console.ReadLine()); }
static int[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e =>int.Parse(e)); }
}

E: 四边形面积

时间限制: 1 s      内存限制: 128 MB    

题目描述

有一个四边形,现在需要求它的面积

输入

输入四行,每行两个数整数x, y (1≤x,y≤1000),四个点是按逆时针输入的。

输出

输出四边形的面积,保留3位小数点,

样例输入

0 0
10 0
1 1
0 11

样例输出

10.500

提示

C语言中保留3位小数用%.3lf   用法:printf("%.3lf",result)

四边形分凸凹四边形。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAhwAAABSCAIAAACQUZoeAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOxAAADsQBlSsOGwAAJsRJREFUeF7tnXt0XFX1xwd5LddyoegKFKlSm7SgPDRaNdBCUyi2FlDE0IIg0DRFqAUUhWSqvBQ7qSCidCHQFJClQtJQ5WFtsdpUqUZaWsQXtAkPKTYkiMBP/QHij9/n3D33zrnvO48kk5lz/pg1c+c89vmec/Y++3HO3e2NN95ImWQQMAgYBAwCBoFSIPCmUlRi6jAIGAQMAgYBg4BCwAgVMw8MAgYBg4BBoGQIGKFSMihNRQYBg4BBwCBghIqZAwYBg4BBwCBQMgSMUCkZlKYig4BBwCBgEDBCxcyBikWAyMb/s1LF9nDMdoyh+cUvfmFCT8fsAEYRboRKCYZ1W3vtgu6hElRkqigdAvCsGTNmHHvssXyWv1ypqimELDn11FOXLFlihErp5nsZ1bRb3uM60LVgSWrW5HR6hdONlsyyvnRrj/27pbs/Xc+PLZna9bP729RXlfg5r0PveuOy3pVNNQFg0MTU/sVSScmTqjydCmmatd2U61dI2wu7c50K6pdVzAZB6rAadQDS6m3MbFo5d5w82JapXTs7715TanltrhKnuQgAg4pkCWhKdfanp/g77hQZ6mpuWDfHP3DqeXqjp6AbBCbAjbW9t861htzdWddfpRnynp6e119//fjjjz/77LNvu+223XbbrTT1xtVSRlNIrbhUdjFmyQ4Y+qHuBQ25xRvVPdeCleXMWpi51rOurSr0ie2t85577jn55JPr6uo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FgTCOgv/6L2GgkCuJEjGAmjUUEqleoYMnlVi4suRxeQbQQzjgWx8/QbBCoGATwYBFFSYwJV2VHXLNUMf2t1I5Ur1BhfySOByQKYVH+F6hU6pCbfhkEyhABDAbIEq7M4ZQutugypNCQlBCB6hUqACRvmeSmQsKNjEs24Ywx2QwCJUcAiYKpgBBzDhejo3B1Rey10yWnwVRYKgSqWqiwISJkizcJmhlcqvlk6jEI5IsAES7cAEsMMVdsyLtfOYNsPJT5wlg++as3+kvGgOBajtphzDWaSvlMSkNJVSHA9WWrV6/WI8i5j4dVOXPmzKrCoWI6W+1CBTWF64ZQtytmRE1HDAJjCAFkCQenuJHPQzOHIo2vfgyNo05qtQuVMTpshmyDQMUgIG9z8CQjUcbu+BqhMnbHzlBuEDAIGATKDoGqdtSX3WgYggwCBgGDwBhHwAiVMT6AhnyDgEHAIFBOCBihUk6jYWgxCBgEDAJjHAEjVMb4ABryDQIGAYNAOSFghEo5jYahxSBgEDAIjHEE/h/W976OfHIWKgAAAABJRU5ErkJggg==" alt="" />

提示都告诉你了

#include<bits/stdc++.h>

using namespace std;
struct Point
{
float x, y;
};
float LinearIntegration(const Point &p1, const Point &p2)
{
return 0.5 * (p2.x - p1.x) * (p2.y + p1.y);
}
float ComputePolygonArea(const Point points[], int length)
{
if (points == NULL || length <= 0) return 0.0;
float area = 0.0;
for (int i = 0; i < length - 1; ++ i)
{
area += LinearIntegration(points[i], points[i + 1]);
}
area += LinearIntegration(points[length - 1], points[0]);
return area >= 0.0 ? area : -area;
}
int main()
{
int n;
Point a[4];
for(int i=0; i<4;i++) cin>>a[i].x>>a[i].y;
float ans = ComputePolygonArea(a,4);
printf("%.3f\n",ans);
return 0;
}

F: 进制转换

时间限制: 1 s      内存限制: 128 MB     

题目描述

给定一个区间[l, r],从l至r之间的所有数依次转换成16进制然后连在一起,接着再转换成10进制,最后再对15取模。

输入

输入两个是l, r (1≤l≤r≤106)

输出

输出对15取模的结果。

样例输入

10 14

样例输出

0

提示

样例说明:

10、11、12、13、14的16进制分别是a、b、c、d、e。依次连在一起是abcde,转换成10进制是703710,对15取模为0。

一般的转化。(a*16^n+b*16^(n-1)..)%15,展开,a%16*16^n%15,16%15就可以不考虑了,于是变成a%15+b%15..。于是简化成a+b+c+d+e。注意取模

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Runtime.InteropServices; public class Program
{
public static void Main()
{
var str = "";
List<int> a = new List<string>(Console.ReadLine().Split()).ConvertAll(i => int.Parse(i));
var sum = 0;
for (int i = a[0]; i <= a[1]; i++)
{
var pa = Convert.ToString(i, 16);
//var pa = Convert.ToInt32(x, 16).ToString();
var len = pa.Length;
for (int j = 0; j < len; j++)
{
if (pa[j] == 'a')
{
sum += (10);
sum %= 15;
}
else if (pa[j] == 'b')
{
sum += (11);
sum %= 15;
}
else if (pa[j] == 'c')
{
sum += (12);
sum %= 15;
}
else if (pa[j] == 'd')
{
sum += (13);
sum %= 15;
}
else if (pa[j] == 'e')
{
sum += (14);
sum %= 15;
}
else if (pa[j] == 'f')
{
sum += (15);
sum %= 15;
}
else
{
sum += int.Parse(pa[j].ToString());
sum %= 15;
}
}
}
Console.WriteLine(sum%15);
Console.ReadKey();
} public static int ri() { return int.Parse(Console.ReadLine()); }
static int[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e =>int.Parse(e)); }
}

2018年江西理工大学C语言程序设计竞赛(初级组)一的更多相关文章

  1. 2018年江西理工大学C语言程序设计竞赛(高级组) 三角平方数

    题目描述 三角数:形如图a,圆点摆放成等边三角形的数字,则为三角数. (图a) 平方数:形如图b,小方块摆放成正方形的数字,则为平方数. (图b) 那么如果一个数字既是三角形数又是平方数,则称为三角平 ...

  2. 2018年江西理工大学C语言程序设计竞赛高级组部分题解

    B Interesting paths 考察范围:组合数学 此题是机器人走方格的变种,n*m的网格,从(1,1)走到(n,m),首先可以明确,水平要走m-1格,竖直要走n-1格,则走到目的地的任意一条 ...

  3. 2017年江西理工大学C语言程序设计竞赛(初级组)

    问题 A: Petr的盒子(初) #include <iostream> #include <stdio.h> #include <algorithm> using ...

  4. 2014江西理工大学C语言程序设计竞赛高级组题解

    1001 Beautiful Palindrome Number 枚举回文数字前半部分,然后判断该数字是否满足,复杂度为O(sqrt(n))! 1002 Recovery Sequence  本题的核 ...

  5. 2017年江西理工大学C语言程序设计竞赛(高级组)

    问题 A: 求近似值 #include <stdio.h> #include <time.h> #include <stdlib.h> using namespac ...

  6. 2014江西理工大学C语言程序竞赛初级组

    坐公交 解法:略 #include<stdio.h> #include<string> #include<iostream> #include<math.h& ...

  7. 2016年江西理工大学C语言程序设计竞赛(高级组)

    问题 A: jxust 解法:争议的问题(是输入整行还是输入字符串),这里倾向输入字符串,然后判断是否含有jxust就行 #include<bits/stdc++.h> using nam ...

  8. 2016年江西理工大学C语言程序设计竞赛(初级组)

    问题 A: 木棒根数 解法:把所有的情况保存下来,加一下就好 #include<bits/stdc++.h> using namespace std; map<char,int> ...

  9. 2015年江西理工大学C语言程序设计竞赛(高级组)

    A 解法:DP+二分 dp[i]=max(dp[i],dp[j]+p[i].v)(i>j) dp[i]表示建立i点之后能够获得的最大值 int n,M; struct node { int l, ...

随机推荐

  1. opencv3 图片模糊操作-均值滤波 高斯滤波 中值滤波 双边滤波

    #include <iostream>#include <opencv2/opencv.hpp> using namespace std;using namespace cv; ...

  2. 1.scala基础语法总结

    Scala基础语法总结:Scala 与 Java 的最大区别是:Scala 语句末尾的分号 ; 是可选的.如果一行里写多个语句那么分号是需要的 val s = "菜鸟教程"; pr ...

  3. mybatis 获得一个map的返回集合

    在使用mybatis 查询结果集,有时会有需求返回一个map比如表 id username 1  name1 2 name2 3 name3 希望的查询结果是一个map 并且以id为key  表为实体 ...

  4. oracle数据库之数据插入、修改和删除

    作为一合格的测试人员对数据库的单表查询.多表查询.分组查询.子查询等等这些基本查询方法还是要会的.不然到企业中,容易被一些人鄙视,或者说如果数据库学不好,表查不明白,那么对自己能力来说也是一种侮辱,因 ...

  5. 第20章-使用JMX管理Spring Bean

    Spring对DI的支持是通过在应用中配置bean属性,这是一种非常不错的方法.不过,一旦应用已经部署并且正在运行,单独使用DI并不能帮助我们改变应用的配置.假设我们希望深入了解正在运行的应用并要在运 ...

  6. QuotedStr函数

    今天学到一个新函数,很有用 QuotedStr(s);// 在s两边加单引号, 这样就不会看着n多的单引号糊涂了...

  7. RobotFramework添加自定义关键字实战

    背景: 此篇文章是上一篇博客python的requests库怎么发送带cookies的请求的后续,上一篇只是使用python脚本调试通过了,接下来要把我们的方法封装为关键字,在RF中调用. 实施: 一 ...

  8. session相关

    判断session是否已失效: HttpSession session=request.getSession(false); getSession(boolean)相比于getSession()更安全 ...

  9. 洛谷P4494 [HAOI2018]反色游戏(tarjan)

    题面 传送门 题解 我们先来考虑一个联通块,这些关系显然可以写成一个异或方程组的形式,形如\(\oplus_{e\in edge_u}x_e=col_u\) 如果这个联通块的黑色点个数为奇数,那么显然 ...

  10. WebApplicationContext wac=WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());这句话的意思

    在jsp中出现 提取的代码: <%   WebApplicationContext wac = WebApplicationContextUtils     .getWebApplication ...