首页
畅所欲言
友情链接
壁纸大全
数据统计
推荐
工具箱
在线白板
Search
1
职教云小助手重构更新,职教云助手最新版下载地址【已和谐】
14,433 阅读
2
职教云-智慧职教,网课观看分析(秒刷网课)
11,699 阅读
3
gradle-5.4.1-all.zip下载
9,694 阅读
4
职教云-智慧职教,签到补签分析(逆天改命系列)
8,270 阅读
5
一个优秀的程序员从写文档开始:免费领14个月语雀云笔记会员
7,084 阅读
学习笔记
Web
Python
转载文章
算法刷题
JS逆向
综合笔记
安卓
物联网
Java
C
资源收集
软件收藏
网络资源
影视专辑
TED英语角
随便写写
随手拍
登录
/
注册
Search
Lan
累计撰写
619
篇文章
累计收到
632
条评论
首页
栏目
学习笔记
Web
Python
转载文章
算法刷题
JS逆向
综合笔记
安卓
物联网
Java
C
资源收集
软件收藏
网络资源
影视专辑
TED英语角
随便写写
随手拍
页面
畅所欲言
友情链接
壁纸大全
数据统计
推荐
工具箱
在线白板
搜索到
619
篇与
的结果
2020-10-12
缩位求和
标题:缩位求和在电子计算机普及以前,人们经常用一个粗略的方法来验算四则运算是否正确。比如:248 * 15 = 3720把乘数和被乘数分别逐位求和,如果是多位数再逐位求和,直到是1位数,得2 + 4 + 8 = 14 ==> 1 + 4 = 5;1 + 5 = 65 * 6而结果逐位求和为 35 * 6 的结果逐位求和与3符合,说明正确的可能性很大!!(不能排除错误)请你写一个计算机程序,对给定的字符串逐位求和:输入为一个由数字组成的串,表示n位数(n<1000);输出为一位数,表示反复逐位求和的结果。例如:输入:35379程序应该输出:9再例如:输入:7583676109608471656473500295825程序应该输出:1资源约定:峰值内存消耗(含虚拟机) < 256MCPU消耗 < 1000ms请严格按要求输出,不要画蛇添足地打印类似:“请您输入...” 的多余内容。所有代码放在同一个源文件中,调试通过后,拷贝提交该源码。不要使用package语句。不要使用jdk1.7及以上版本的特性。主类的名字必须是:Main,否则按无效代码处理。import java.util.Scanner; public class 缩位求和 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); String num = sc.next(); while (num.length()!=1){ int temp = 0; for (int i = 0; i < num.length(); i++) { temp+=num.charAt(i)-'0'; } num = String.valueOf(temp); } System.out.println(num); } }
2020年10月12日
834 阅读
0 评论
0 点赞
2020-10-10
安卓MPAndroidChart绘制水平柱状图
这个和垂直柱状图一模一样,只不过把控件名换了一下从barchart换成了HorizontalBarChartXML文件<LinearLayout android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="水平柱状图" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="150dp" android:orientation="vertical"> <com.github.mikephil.charting.charts.HorizontalBarChart android:id="@+id/horizontalBarChart" android:layout_width="match_parent" android:layout_height="150dp" /> </LinearLayout>MainActivity//初始化水平柱状图 HorizontalBarChart horizontalBarChart = findViewById(R.id.horizontalBarChart); initBarChart(horizontalBarChart); horizontalBarChart.setData(setBarData()); barChart.invalidate(); public BarChart initBarChart(BarChart barChart) { barChart.setDrawBarShadow(false); // 设置每条柱子的阴影不显示 barChart.setDrawValueAboveBar(true); // 设置每条柱子的数值显示 barChart.setPinchZoom(false); XAxis xAxis = barChart.getXAxis(); // 获取柱状图的x轴 YAxis yAxisLeft = barChart.getAxisLeft(); // 获取柱状图左侧的y轴 YAxis yAxisRight = barChart.getAxisRight(); // 获取柱状图右侧的y轴 setAxis(xAxis, yAxisLeft, yAxisRight); //调用方法设置柱状图的轴线 return barChart; } public BarData setBarData() { List<BarEntry> entries = new ArrayList<>(); //定义一个数据容器 //生成随机数数据 for (int i = 0; i <= 12; i++) { entries.add(new BarEntry(i, new Random().nextInt(300))); } BarDataSet barDataSet = new BarDataSet(entries, "测试数据"); BarData barData = new BarData(barDataSet); return barData; //返回可用于柱状图的数据 }文章参考:https://blog.csdn.net/weixin_43344890/article/details/103008320
2020年10月10日
1,387 阅读
0 评论
0 点赞
2020-10-09
安卓MPAndroidChart绘制多层级的堆叠条形图
这次是在上一篇的基础上增加的,所以导包这些啥的就跳过了研究了一下代码,发现主要的区别就在于增加data的时候,第二个参数传递的是一个数组,然后就变成了堆叠条形图。最后的代码:XML布局文件:<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="这是一个柱状图" android:gravity="center"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="150dp" android:orientation="vertical"> <com.github.mikephil.charting.charts.BarChart android:id="@+id/barChart" android:layout_width="match_parent" android:layout_height="150dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="这是一个堆叠条形图" android:gravity="center"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="150dp" android:orientation="vertical"> <com.github.mikephil.charting.charts.BarChart android:id="@+id/duiDieChart" android:layout_width="match_parent" android:layout_height="150dp" /> </LinearLayout> </LinearLayout>MainActivity,这里只把堆叠图的代码放出来了,之前的看上一篇文章public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { BarChart duiDieChart = findViewById(R.id.duiDieChart); duiDieChart.getDescription().setEnabled(false); duiDieChart.setMaxVisibleValueCount(40); // 扩展现在只能分别在x轴和y轴 duiDieChart.setPinchZoom(false); duiDieChart.setDrawGridBackground(false); duiDieChart.setDrawBarShadow(false); duiDieChart.setDrawValueAboveBar(false); duiDieChart.setHighlightFullBarEnabled(false); // 改变y标签的位置 YAxis leftAxis = duiDieChart.getAxisLeft(); leftAxis.setDrawGridLines(false); leftAxis.setAxisMinimum(0f); duiDieChart.getAxisRight().setEnabled(false); XAxis xLabels = duiDieChart.getXAxis(); xLabels.setDrawGridLines(true); xLabels.setPosition(XAxis.XAxisPosition.TOP); Legend l = duiDieChart.getLegend(); l.setVerticalAlignment(Legend.LegendVerticalAlignment.BOTTOM); l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT); l.setOrientation(Legend.LegendOrientation.HORIZONTAL); l.setDrawInside(false); l.setFormSize(8f); l.setFormToTextSpace(4f); l.setXEntrySpace(6f); ArrayList<BarEntry> weiZhangZhanBi = new ArrayList<>(); for (int i = 0; i <= 5; i++) { float a = new Random().nextInt(400); float b = new Random().nextInt(400); weiZhangZhanBi.add(new BarEntry(i, new float[]{a, b})); } BarDataSet set1; if (duiDieChart.getData() != null && duiDieChart.getData().getDataSetCount() > 0) { set1 = (BarDataSet) duiDieChart.getData().getDataSetByIndex(0); set1.setValues(weiZhangZhanBi); duiDieChart.getData().notifyDataChanged(); duiDieChart.notifyDataSetChanged(); } else { set1 = new BarDataSet(weiZhangZhanBi, "年龄群体车辆违章的占比统计 "); set1.setColors(getColors()); set1.setStackLabels(new String[]{"有违章", "无违章"}); ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>(); dataSets.add(set1); BarData data = new BarData(dataSets); data.setValueTextColor(Color.WHITE); duiDieChart.setData(data); } duiDieChart.setFitBars(true); duiDieChart.invalidate(); } }看着这篇文章来的:https://blog.csdn.net/qq_26787115/article/details/53323046
2020年10月09日
931 阅读
0 评论
0 点赞
2020-10-09
安卓MPAndroidChart绘制柱状图
首先是添加Jar包进入Gradle Scripts的目录,添加Jar包都在这里首先是Project这个的allprojects里面加上一行allprojects { repositories { google() jcenter() maven { url "https://jitpack.io" } } }在app这个里面denpendencies中弄成这样子的dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' }然后这是xml布局文件<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:id="@+id/chart" android:layout_width="match_parent" android:layout_height="150dp" android:orientation="vertical"> <com.github.mikephil.charting.charts.BarChart android:id="@+id/barChart" android:layout_width="match_parent" android:layout_height="150dp" /> </LinearLayout> </LinearLayout>然后这是Mainactivity的代码package ink.cik.echartsstu; import android.os.Bundle; import android.os.Trace; import androidx.appcompat.app.AppCompatActivity; import com.github.mikephil.charting.charts.BarChart; import com.github.mikephil.charting.charts.LineChart; import com.github.mikephil.charting.components.Description; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.components.YAxis; import com.github.mikephil.charting.data.BarData; import com.github.mikephil.charting.data.BarDataSet; import com.github.mikephil.charting.data.BarEntry; import java.util.ArrayList; import java.util.List; import java.util.Random; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //定义一下界面的控件 BarChart barChart = findViewById(R.id.barChart); initBarChart(barChart); //初始化一个柱状图 barChart.setData(setBarData()); //给柱状图添加数据 barChart.invalidate(); //让柱状图填充数据后刷新 } public BarData setBarData() { List<BarEntry> entries = new ArrayList<>(); //定义一个数据容器 //生成随机数数据 for (int i = 0; i <= 12; i++) { entries.add(new BarEntry(i, new Random().nextInt(300))); } BarDataSet barDataSet = new BarDataSet(entries, "测试数据"); BarData barData = new BarData(barDataSet); return barData; //返回可用于柱状图的数据 } public BarChart initBarChart(BarChart barChart) { barChart.setDrawBarShadow(false); // 设置每条柱子的阴影不显示 barChart.setDrawValueAboveBar(true); // 设置每条柱子的数值显示 XAxis xAxis = barChart.getXAxis(); // 获取柱状图的x轴 YAxis yAxisLeft = barChart.getAxisLeft(); // 获取柱状图左侧的y轴 YAxis yAxisRight = barChart.getAxisRight(); // 获取柱状图右侧的y轴 setAxis(xAxis, yAxisLeft, yAxisRight); //调用方法设置柱状图的轴线 return barChart; } public void setAxis(XAxis xAxis, YAxis leftAxis, YAxis rightAxis) { xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); // 这里设置x轴在柱状图底部显示 xAxis.setAxisLineWidth(1); //设置x轴宽度 xAxis.setAxisMinimum(0); //设置x轴从0开始绘画 xAxis.setDrawAxisLine(true); //设置x轴的轴线显示 xAxis.setDrawGridLines(false);//设置x轴的表格线不显示 xAxis.setEnabled(true); // 设置x轴显示 leftAxis.setAxisMinimum(0); //设置y轴从0刻度开始 leftAxis.setDrawGridLines(false); // 这里设置左侧y轴不显示表格线 leftAxis.setDrawAxisLine(true); // 这里设置左侧y轴显示轴线 leftAxis.setAxisLineWidth(1); //设置y轴宽度 leftAxis.setEnabled(true); //设置左侧的y轴显示 rightAxis.setAxisMinimum(0); //设置y轴从0刻度开始 rightAxis.setDrawGridLines(false);// 这里设置右侧y轴不显示表格线 rightAxis.setDrawAxisLine(true); // 这里设置右侧y轴显示轴线 rightAxis.setAxisLineWidth(1); //设置右侧y轴宽度 rightAxis.setEnabled(true); //设置右侧的y轴显示 } }
2020年10月09日
2,173 阅读
0 评论
0 点赞
2020-10-08
【开源程序】API管理程序
后端用的Django,前面页面用的是韩小韩api扒下来的页面(请勿见怪)Github地址:暂无
2020年10月08日
850 阅读
0 评论
2 点赞
2020-10-04
汤圆创作小说检索信息采集
前段时间,因为一些原因,所以需要对这个汤圆创作的小说进行检索,于是写了几行python代码解析了一下搜索出来的结果的信息。# -*- coding: utf-8 -*- """ ------------------------------------------------- @ Author :Lan @ Blog :www.lanol.cn @ Date : 2020/9/30 @ Description:I'm in charge of my Code ------------------------------------------------- """ import requests import parsel for i in range(1, 10094): url = f'https://www.itangyuan.com/search/book/%E4%B8%80%20%E7%94%9F.html?page={i}' res = requests.get(url).text xpathFile = parsel.Selector(res) author = xpathFile.xpath("//p[@class='author']/a/text()").extract() name = xpathFile.xpath("//p[@class='bname']/a/text()").extract() info = xpathFile.xpath("//p[@class='rw_info']/text()").extract() for index, value in enumerate(name): if '一' in value.replace(' ', '') and '生' in value.replace(' ', ''): if int(info[index].split('阅读')[0].replace(' ', '')) < 1000: print(value, author[index], info[index].split('/')[-1]) print(f'已检测至第{i}页')大概就是搜索出所有小说名包含一和生字且阅读量小于1000的。
2020年10月04日
960 阅读
0 评论
0 点赞
2020-09-29
Django设置全局模板变量
最近由于需要,之前做的一个项目需要将图片文件转移至COS对象储存,因为服务器网络不行,图片加载太慢。经过一番猛如虎的操作,目的还是达到了。但是问题来了,图片上传好了,那怎么访问呢,我一开始想的是在数据里加一个表,就是用来存一些默认的字段。但是每次都得去取一次,然后还得返回,感觉实在有点浪费,于是想着有没有全局模板变量,就像我在模板中可以直接调用request.user一样。经过百度,找到了答案。先在一个view中添加你要返回的默认值然后在settings中的Templates->OPTIONS->context_processors进行注册(大概是这样叫吧,个人理解)然后就可以直接在模板中引用这个值了。
2020年09月29日
718 阅读
0 评论
0 点赞
1
...
41
42
43
...
89