NBUT-2019-ICPC训练赛
只写了几道能写的题菜是原罪AMental rotation is a difficult thing to master. Mental rotation is the ability to imagine in your mind how an object would look like from a viewer’s side if you were to rotate it in a particular direction. It is something very important for engineers to learn and master, especially if you are required to do engineering drawing. There are many stages to these mental rotation tasks. We will approach a simple rotation task in this problem.If you are given the following square -After rotating it to the right once, it will look like the following -After rotating it to the left once, it will look like the following -For this problem you will be given an initial square of size n and a list of rotations to perform.Your task is to output the final representation of the square after performing all the rotation.InputThe first line of input contains an integer N (1 ≤ N ≤ 1000). and a string containing a combination of ′L′ and ′R′. Where ′L′ means left rotation and ′R′ means right rotation. Length of the string will not exceed 100. Starting from the second line, the following N line each will contain N of the following characters (, , ∨, ∧ or .). Empty space is indicated by a ‘.’ (dot).OutputThe output should be N lines, each containing N characters representing the final representation of the square after all the rotation. For ∨ and ∧ use v (small v) and Shift6 respectively.ExamplesInput3 Rv…^Output^.v.^.vInput3 Lv…^Output^.v.^.vInput3 LLv…^Outputv…^1水题代码模拟就行了。#includeiostream using namespace std; char a[1005][1005], t[1005][1005]; int n; string s; void L_rotaing() { for(int i 0; i n; i) for(int j 0; j n; j) t[i][j] a[j][n-1-i]; for(int i 0; i n; i) for(int j 0; j n; j) { if(t[i][j] ) a[i][j] ^; else if(t[i][j] ) a[i][j] v; else if(t[i][j] v) a[i][j] ; else if(t[i][j] ^) a[i][j] ; else if(t[i][j] .) a[i][j] .; } } void R_rotaing() { for(int i 0; i n; i) for(int j 0; j n; j) t[i][j] a[n-j-1][i]; for(int i 0; i n; i) for(int j 0; j n; j) { if(t[i][j] ) a[i][j] v; else if(t[i][j] ) a[i][j] ^; else if(t[i][j] v) a[i][j] ; else if(t[i][j] ^) a[i][j] ; else if(t[i][j] .) a[i][j] .; } } int main() { cin n; cin s; for(int i 0; i n; i) for(int j 0; j n; j) cin a[i][j]; for(int i 0; i s.length(); i) if(s[i] R) R_rotaing(); else L_rotaing(); for(int i 0; i n; i,coutendl) for(int j 0; j n; j) cout a[i][j]; return 0; }B:Sponge Bob, the famous cartoon character can only wear square shape pants. Squares shape can be described in geometry as having 4 right angles, just like rectangles. But a square is a special case of rectangle where its width and height are the same.You are given the width and the height of a 4 right angled shape and need to figure out if it is a square or a rectangle for Sponge Bob. He will get all the square ones as his new pants for the coming Eidul Fitri.InputThe first line contains T, the number of test cases. For each test case there is a line with two integers (1 ≤ w,h ≤ 1,000,000) representing width and height, respectively.OutputFor each test case, print one line consists of ′YES′ (without quotes) if the shape is a square and good for Sponge Bob’s pants, otherwise print ′NO′ (without quotes) if it is a rectangle and not suitable to be Sponge Bob’s pants.ExampleInput49 916 30200 33547 547OutputYESNONOYES代码#include bits/stdc.h using namespace std; int main() { int t, w, h; scanf(%d, t); while (t--) { scanf(%d%d, w, h); printf(w ! h ? NO\n : YES\n); } return 0; } C: Nina from the IT support needs your help with another daily puzzle she faces. She is able to take her lunch break anytime she wants. But because of limited capacity, she only can take S minutes based on the needs that day. Any extra minutes that she is late, she has to pay RM1 to the late jar.She prepared a list of her favorite restaurants and how long it would take for her to lunch in each restaurant based on experience, (1 ≤ ti ≤ 109 ). She also assigned a value for each of the restaurants that shows how much extra she is willing to pay but still be happy, (1 ≤ fi ≤ 109 ).For example, if she needs tx minutes to dine in restaurant x which she values RMfx . If tx≤S then she is fully happy and it is as if she saved RMfx.But if txS she would save fx−(tx−S).Please help her to find the restaurant that she would be happiest in and meanwhile save the most. Also, keep in mind she can choose exactly one restaurant to lunch each day.InputThe first line contains an integer – D(1≤D≤10) – the number of days.The second line contains two space-separated integers — N(1≤N≤104) and S(1≤S≤109) — the number of restaurants in Nina’s list and her lunch break time for the day, correspondingly.Each of the next N lines contains two space-separated integers — fi(1≤fi≤109) and ti (1≤ti≤109) — the characteristics of the ith restaurant.OutputIn a single line print a single integer — the maximum money she is saving/her happiness by day.ExampleInput22 53 34 51 51 7OutputCase #1: 4Case #2: -1贪心求最大代码#include bits/stdc.h using namespace std; const int inf 0x3f3f3f3f; int main() { int t, n, m, kase 0; scanf(%d, t); while (t--) { int max_ -inf; scanf(%d%d, n, m); for (int i 0; i n; i) { int u, v; scanf(%d%d, u, v); if (v m) max_ max(max_, u); else max_ max(max_, u - (v - m)); } printf(Case #%d: %d\n, kase, max_); } return 0; }E:The main hall of your residency is open for use by the local community and public. Since it was built on public donations, there is no charge of using it. Every weekend particularly on public holidays there are up to 50 reservations to use it for multiple events with different durations.You have been assigned by the residents to develop a program in choosing events to get most out of allocation time per weekend and have as short unused time as possible. Program should find the event(s) which fill(s) the allocation time best and print it in the same sequence as appears in the reservation list.InputEach test case consist of a single line.The line starts with two integer T and N which is the time allocated for the hall to be used in the particular weekend and the number of events. The next T integer are the durations of the events (as appear in the reservation list). For example from the first line in sample data: T5 hours, N, number of events 5, first event lasts for 1 hour, second is 2 hours, third is 3 hours, fourth is 4 hours, and the last one is 5 hours.The input process will be terminated by a line containing 0.OutputFor each line of input value, in a single line, first, output a list of integers which are the selected events duration and another integer which is the sum of the selected events duration.If there are multiple possible list of events, events that appear earlier in the list takes priority.ExampleInput5 5 1 2 3 4 510 9 11 9 3 5 8 4 9 3 216 8 12 6 11 11 13 1 10 713 5 10 12 2 13 1028 14 18 19 26 15 18 24 7 21 14 25 2 12 9 60Output1 4 53 5 2 106 10 1613 1319 7 2 2801背包记录路径代码#includeiostream #includecstdio #includecstring using namespace std; int dp[10005]; bool path[105][10005]; int c[10005],w[10005]; int main() { int N,V; while (cinVV) { cinN; memset(path,0,sizeof(path)); memset(dp,0,sizeof(dp)); for (int i 1;i N;i) { cinc[i]; w[i]c[i]; } for (int i N;i 1;--i) { for (int j V;j c[i];--j) { if (dp[j] dp[j-c[i]]w[i]) { dp[j] dp[j-c[i]]w[i]; path[i][j] 1; } } } for (int i 1,j V;i Nj 0;i) { if (path[i][j]) { printf(%d ,w[i]); j - c[i]; } } coutdp[V]endl; //puts(); } return 0; }I:Ethics regarding artificial intelligence (AI) is an important topic at current times. With recent advancement in the field of self-learning algorithms, the scientific community is facing a hard question of how to introduce ethics in software systems. The question of ethics is particularly difficult due to its subjective nature. What is considered ‘right’ by a particular viewpoint is not necessarily considered ‘right’ by every other viewpoint.The question of ethics in AI agents becomes even more difficult when the agents are faced with ethical dilemmas. Ethical dilemmas are situations when there is no clear answer regarding the best solution to a problem because all possible solutions lead to certain negative impact. For example, if you press a button then 1 person will die and if you do not press the button then 5 persons will die. If these two are the options then which to follow. If the system believes in the philosophy of non-maleficence, doing the least amount of harm, then the system would take the course of pressing the button and let 1 person die instead of 5 people.This example is a very simplified approach of portraying an ethical dilemma, but in real life, the AI agents would face much more complex and subtle scenarios requiring a proper ethical framework for them to follow.In this problem, we are dealing with a RoboTaxi that can only go straight (a lucky one). You will be provided with a snapshot of a 3lane road with multiple obstacles in it. You will have to determine whether the RoboTaxi will crash or not within the given snapshot.InputThe input consists of 3 lines.A ‘’ indicates the position of the RoboTaxi.‘H’ indicates human in the lane.‘T’ indicates tree in the lane.‘P’ indicates parked car in the lane.‘.’ indicates empty space in the lane.The length of the road will be 10.OutputOutput will be the indicator of the first obstacle that the RoboTaxi crashes into. If no crash occurs then output ‘Youshallpass!!!’.ExamplesInput………OutputYou shall pass!!!Input……H…OutputHInput……T…OutputTInput…P…TH…POutputT代码#include bits/stdc.h using namespace std; int main() { char str[5][15]; int sx, sy; for (int i 0; i 3; i) scanf(%s, str[i]); for (int i 0; i 3; i) { for (int j 0; j 10; j) { if (str[i][j] ) { sx i, sy j; break; } } } int l sy 1; while (l 10) { if (str[sx][l] ! .) break; l; } if (l 10) printf(%c\n, str[sx][l]); else printf(You shall pass!!!\n); return 0; }K:Nina works as an IT support in a software company and always busy. The biggest issue she is facing is that sometimes she misses some deadlines. In their team the time needed to finish each customer request is estimated based on experience, 1≤x≤105. The moment a request is submitted, she has double of the estimated time to respond to the request, 2x. Meaning if the request A was submitted at 12pm and takes 2 hours to finish, she can wait 2 hours and then work on it for 2 hours and still finish the job on time, by 4 pm and the customer would be satisfied.Sometimes there is not enough capacity and she has to pick up a lot of requests, and it is expected to miss some deadlines. But she needs your help, to see if arrange correctly what are the maximum requests she can finish before their deadlines.Let’s assume that she has the list of the requests and their deadline immediately as she starts working every day and she doesn’t take any break until she is done with all of them.InputThe first line contains integer m (1≤m≤20). Number of cases.The second line contains integer n (1≤n≤105). Number of the requests.The last line contains n integers ti (1≤ti≤109), separated by spaces. Estimated time each request should be responded so the customer would be happy.OutputPrint the case number and a single number - the maximum number of satisfied customer for each case.ExampleInput1515 2 1 5 3OutputCase #1: 4NoteIf she responds to the request with this order 1, 2, 3, 5, 15, the only customer with the request that requires 5 hours wouldn’t be happy.贪心 给你每个请求的响应时间求最大满意客户数代码#include bits/stdc.h using namespace std; const int MAXN 1e5 5; const int MAXM 105; int spt[MAXN]; int main() { int t, n, cnt, kase 0; scanf(%d, t); while (t--) { cnt 0; long long ans 0; scanf(%d, n); for (int i 0; i n; i) scanf(%d, spt i); sort(spt, spt n); for (int i 0; i n; i) { if (ans spt[i]) { cnt; ans spt[i]; } } printf(Case #%d: %d\n, kase, cnt); } return 0; }

相关新闻

Livewire 3构建高效Quiz系统的实战指南

Livewire 3构建高效Quiz系统的实战指南

1. 为什么选择Livewire 3构建Quiz系统? 去年接手一个在线教育项目时,我需要在两周内交付一个能支持千人并发的随堂测试模块。当时评估了三种方案:传统PHP表单提交、Vue前后端分离架构,以及当时刚发布不久的Livewire 3。最终选择Li…

2026/7/28 14:48:20 阅读更多 →
QQ聊天记录本地数据库解密:逆向工程与数据恢复实战指南

QQ聊天记录本地数据库解密:逆向工程与数据恢复实战指南

1. 项目概述:从数据安全视角看QQ聊天记录解密最近在数据安全与取证分析的圈子里,关于即时通讯应用本地数据解密的话题热度一直不减。特别是像QQ这样拥有海量用户、数据格式又历经多次变更的“老牌”应用,其本地数据库的解密需求,常…

2026/7/28 14:47:20 阅读更多 →
CSS3动画与3D

CSS3动画与3D

1、CSS3过渡在CSS3中,可以利用transition属性使元素的某一个属性在指定的时间内从“一个属性值”平滑过渡到“另外一个属性值”,从而实现动画效果。1)transition属性(1)transition-duration属性transition-duration属性…

2026/7/28 14:47:20 阅读更多 →

最新新闻

焊接缺陷如何分辨

焊接缺陷如何分辨

焊接缺陷如何分辨 一、 一般常见的焊接缺陷可分为四类: (1)焊缝尺寸不符合要求:如焊缝超高、超宽、过窄、高低差过大、焊缝过渡到母材不圆滑等。 (2)焊接表面缺陷:如咬边、焊瘤、内凹、满溢、未焊透、表面气孔、表面裂纹等。 (3)焊缝内部缺陷:如气孔、夹渣、裂纹…

2026/7/28 14:54:22 阅读更多 →
Play Integrity API Checker 技术架构深度解析:Android设备完整性验证实战指南

Play Integrity API Checker 技术架构深度解析:Android设备完整性验证实战指南

Play Integrity API Checker 技术架构深度解析:Android设备完整性验证实战指南 【免费下载链接】play-integrity-checker-app Get info about your Device Integrity through the Play Intergrity API 项目地址: https://gitcode.com/gh_mirrors/pl/play-integrit…

2026/7/28 14:54:22 阅读更多 →
深度学习框架到AI系统实战:佐治亚理工2025课程解析

深度学习框架到AI系统实战:佐治亚理工2025课程解析

为什么很多开发者学了深度学习框架,却依然写不出可靠的AI系统?为什么掌握了TensorFlow和PyTorch,面对真实业务场景时还是无从下手?问题的核心在于:缺少对经典AI算法的深度理解,以及将算法转化为可落地系统的工程能力。 佐治亚理工学院的人工智能课程正是为解决这一痛点而…

2026/7/28 14:54:22 阅读更多 →
终极指南:使用DDrawCompat在Windows 11上完美运行经典老游戏

终极指南:使用DDrawCompat在Windows 11上完美运行经典老游戏

终极指南:使用DDrawCompat在Windows 11上完美运行经典老游戏 【免费下载链接】DDrawCompat DirectDraw and Direct3D 1-7 compatibility, performance and visual enhancements for Windows Vista, 7, 8, 10 and 11 项目地址: https://gitcode.com/gh_mirrors/dd/…

2026/7/28 14:54:22 阅读更多 →
焊接理论知识

焊接理论知识

焊接理论知识 一、焊接的定义:焊接是通过对物体的加热,加压或者两者并用,使焊接连接处达到原子间力的相互作用,使分离的物体连接成一个新的整体的加工工艺。 二、焊接的方法分类:按照焊接过程中金属所处的状态和工艺特点可分为三类:熔化焊、压力焊、钎焊。 三、焊接过…

2026/7/28 14:54:21 阅读更多 →
NBM5100A与PIC18F86J16在物联网终端的低功耗设计实践

NBM5100A与PIC18F86J16在物联网终端的低功耗设计实践

1. NBM5100A与PIC18F86J16的协同设计背景 在物联网终端设备设计中,工程师们长期面临一个经典矛盾:传感器节点需要周期性发射无线信号(如LoRaWAN、NB-IoT),每次射频发射时会产生150mA以上的瞬时电流需求,但日…

2026/7/28 14:53:21 阅读更多 →

日新闻

告别臃肿!3步让你的暗影精灵笔记本重获新生

告别臃肿!3步让你的暗影精灵笔记本重获新生

告别臃肿!3步让你的暗影精灵笔记本重获新生 【免费下载链接】OmenSuperHub Control Omen laptop performance, fan speeds, and keyboard lighting, and unlock power limits. 项目地址: https://gitcode.com/gh_mirrors/om/OmenSuperHub 你是否也曾为官方Om…

2026/7/28 0:00:43 阅读更多 →
RAG必踩坑!财报法规检索不准?这款开源工具让答案浮出水面,准确率飙升98.7%!

RAG必踩坑!财报法规检索不准?这款开源工具让答案浮出水面,准确率飙升98.7%!

做 RAG 的人应该都踩过这个致命的坑:把几百页的财报、法规、技术手册扔给向量库,问一个具体问题,搜出来的全是沾边但没用的内容 —— 关键信息要么被硬切块拆碎了,要么藏在几十条结果的最下面。语义相似≠真正相关,这个…

2026/7/28 0:00:43 阅读更多 →
抖音视频文案提取工具全指南:免费2026版、手机App、在线工具一网打尽

抖音视频文案提取工具全指南:免费2026版、手机App、在线工具一网打尽

2026年做短视频运营,从抖音上扒文案早就不是偷偷抄笔记的事了。我刚开始做内容的时候,每天刷半小时抖音,手动把爆款视频的口播敲进备忘录,一条2分钟的视频得花十来分钟,碰到语速快的还要反复回听。后来试了一圈工具&am…

2026/7/28 0:00:43 阅读更多 →

周新闻

深度学习道路桥梁裂缝检测系统 道路桥梁裂缝检测数据集 道路桥梁病害识别检测数据集

深度学习道路桥梁裂缝检测系统 道路桥梁裂缝检测数据集 道路桥梁病害识别检测数据集

深度学习道路桥梁裂缝检测系统 数据集6000张 完整源码已标注数据集训练好的模型环境配置教程程序运行说明文档,可以直接使用!系统支持图片、视频、摄像头等多种方式检测裂缝,功能强大实用。 1数据集6000张 8各类别

2026/7/28 12:04:22 阅读更多 →
深度学习YOLO模型如何训练 PUBG 绝地求生目标检测数据集

深度学习YOLO模型如何训练 PUBG 绝地求生目标检测数据集

pubg数据集 精选原图1.42万数据 1.49万标签 无任何重复、算法增强或冗余图像! pubg绝地求生目标检测数据集 1分类:e_body,14905个标签,txt格式 共计14244张图,99%为640*640尺寸图像 适合yolo目标检测、AI训练关键词&am…

2026/7/28 8:29:16 阅读更多 →
Apex英雄目标检测数据集 深度学习框架YOLO如何训练APEX数据集

Apex英雄目标检测数据集 深度学习框架YOLO如何训练APEX数据集

Apex检测数据集数据集详情检测类别: allies enemy tag图片总量:7247张训练集:5139张验证集:1425张测试集:683张标注状态:全部已标注,即拿即用数据格式:支持YOLO格式及其他格式&#…

2026/7/28 5:03:42 阅读更多 →

月新闻