1006 Sign In and Sign Out

10 篇文章 0 订阅
9 篇文章 0 订阅

题目描述:

At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you are supposed to find the ones who have unlocked and locked the door on that day.

Input Specification:

Each input file contains one test case. Each case contains the records for one day. The case starts with a positive integer M, which is the total number of records, followed by M lines, each in the format:

ID_number Sign_in_time Sign_out_time

where times are given in the format HH:MM:SS, and ID_number is a string with no more than 15 characters.

Output Specification:

For each test case, output in one line the ID numbers of the persons who have unlocked and locked the door on that day. The two ID numbers must be separated by one space.

Note: It is guaranteed that the records are consistent. That is, the sign in time must be earlier than the sign out time for each person, and there are no two persons sign in or out at the same moment.

Sample Input:

3
CS301111 15:30:28 17:00:10
SC3021234 08:00:00 11:25:25
CS301133 21:45:00 21:58:40

Sample Output:

SC3021234 CS301133

解题思路 :

在输入数据过程中,比较各学生的进入和离开时间,找到最早和最晚时间的学生下标

 

类构建:

class student
{
public:
	string name;
	string start;
	string end;

	student() :name(""), start(""), end("") {};
};

读数据时开辟一个数组来存放就ok

比较函数:

int compare(string a, string b)
{
	int len = a.length();

	for (int i = 0; i < len; i++)
	{
		if (a[i] != b[i])
		{
			return a[i] - b[i];
		}
	}

	return 0;
}

返回值大于0就是更晚,等于0就是相等,小于0就是更早;

还要定义MAX和MIN来每次记录数据读取的最早和最晚值

string Max = "00:00:00";
string Min = "23:59:59";

定义MAX要定义为最早时间方便初始化,MIN同理

 


代码:

#include <bits/stdc++.h>
using namespace std;

string Max = "00:00:00";
string Min = "23:59:59";

class student
{
public:
	string name;
	string start;
	string end;

	student() :name(""), start(""), end("") {};
};

int compare(string a, string b)
{
	int len = a.length();

	for (int i = 0; i < len; i++)
	{
		if (a[i] != b[i])
		{
			return a[i] - b[i];
		}
	}

	return 0;
}

int main()
{
	int n;
	cin >> n;

	int early = 0, late = 0;

	student* arr = new student[n];

	for (int i = 0; i < n; i++)
	{
		string a, b, c;
		cin >> a >> b >> c;

		arr[i].name = a;
		arr[i].start = b;
		arr[i].end = c;

		if (compare(b, Min) <= 0)
		{
			early = i;
			Min = b;
		}

		if (compare(c, Max) >= 0)
		{
			late = i;
			Max = c;
		}
	}

	cout << arr[early].name << " " << arr[late].name;

	return 0;
}

结果截图:

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Look around the textbook market and you will nd countless books on computer networks, data communication, and the Internet. Why did we write this textbook? We generally see these books taking one of three forms. The rst are the computer science and business-oriented texts that are heavy on networking theory and usage with little emphasis on practical matters. They cover Transmission Control Protocol/Internet Protocol (TCP/IP), Internet servers, and the foundations for telecommunications but do not provide guidance on how to implement a server. The second are the books that take the opposite approach: strictly hands-on texts with little to know the theory or foun- dational material. In teaching computer information technology courses, we have found numerous books that instruct students on how to con gure a server but not on how the server actually works. Finally, there are books on socket-level programming. This textbook attempts to combine the aspects of the rst and second groups mentioned previ- ously. We do so by dividing the material roughly into two categories: concept chapters and case study chapters. We present networks and the Internet from several perspectives: the underlying media, the protocols, the hardware, the servers and their uses. For many of the concepts covered, we follow them with case study chapters that examine how to install, con gure, and secure a server that offers the given service discussed. This textbook can be used in several different ways for a college course. As a one-semester introduction to computer networks, teachers might try to cover the rst ve chapters. These chapters introduce local area networks (LANs), wide area networks (WANs), wireless LANs, tools for exploring networks, and the domain name system. Such a course could also spotlight later topics such as the Hypertext Transfer Protocol (HTTP) and cloud computing. A two-semester sequence on networks could cover the entire book, although some of the case studies might be shortened if the course is targeting computer science or business students as that audience may not to know servers such as Apache and Squid in depth. A computer information technology course might cover the case studies in detail while covering the concept chapters as more of an overview. Finally, an advanced networking course might cover Domain Name System (DNS) (Chapter 5), HTTP (Chapter 7), proxy servers (Chapter 9), and cloud computing (Chapters 11 and 12). As we wrote this textbook, it evolved several times. Our original intention was to write a book that would directly support our course CIT 436/536 (Web Server Administration). As such, we were going to cover in detail the Bind DNS name server, the Apache web server, and the Squid proxy server. However, as we wrote this book, we realized that we should provide background on these servers by discussing DNS, Dynamic Host Con guration Protocol, HTTP, HTTP Secure, digital certi cates and encryption, web caches, and the variety of protocols that support web caching. As we expanded the content of the text, we decided that we could also include introductory networking content as well as advanced Internet content, and thus, we added chapters on networks, LANs and WANs, TCP/IP, TCP/IP tools, cloud computing, and an examination of the Amazon Cloud Service. The book grew to be too large. Therefore, to offset the cost of a longer textbook, we have identi- ed the content that we feel could be moved out of the printed book and made electronically avail- able via the textbook’s companion website. Most of the items on the website are not optional reading but signi cant content that accompanies the chapters that it was taken from. You will nd indicators throughout the book of additional readings that should be pursued. xvii xviii Preface In addition to the text on the website, there are a number of other useful resources for faculty and students alike. These include a complete laboratory manual for installing, con guring, securing, and experimenting with many of the servers discussed in the text, PowerPoint notes, animation tuto- rials to illustrate some of the concepts, two appendices, glossary of vocabulary terms, and complete input/output listings for the example Amazon cloud operations covered in Chapter 12. https://www.crcpress.com/Internet-Infrastructure-Networking-Web-Services-and-Cloud- Computing/Fox-Hao/p/book/9781138039919
In this preface, I’ll tell you about the history of Minimal Perl and the origins of this book. THE HISTORY OF MINIMAL PERL The seeds of this book were sown many years ago, when I was building up my knowl- edge of Perl, the greatest programming language I’d ever encountered (before or since). While reading a variety of books on the subject, I was surprised that the authors felt obliged to delve into so many of the different but equivalent choices for expressing every basic operation in the language, as well as each of the syntactic variations for expressing any one of those choices. As an example, I’ve shown here some of the available choices for expressing in Perl the simple idea that B should be executed only if A is True (with those letters repre- senting arbitrary program elements). Both forward and backward variations for expressing the dependency are included:1 Although some are inclined to present symptoms like these of Perl’s complexity and redundancy as evidence of its “richness,” “versatility,” or “expressiveness,” many Perl novices would surely have a different reaction—that Perl is needlessly complex and too hard to learn. Minimal Perl was created to address these obstacles presented by Perl’s redundancy and complexity. By emphasizing Perl’s grep, sed, and awk-like features, and relying Forward Backward A and B; B if A; A && B; B if A; A and do { B }; do { B } if A; A && do { B }; do { B } if A; if (A) { B }; B if A; unless (!A) { B }; B unless !A; 1Before you despair, I should point out that Minimal Perl uses only 2 of these variations—which is all anybody needs! xx on concepts such as inputs, filters, and arguments, it allows Unix1 users to directly apply their existing knowledge to the task of learning Perl. So rather than being frustrated with Perl’s complexities and disappointed with its steep learning curve, they quickly and painlessly acquire the ability to write useful programs that can solve a wide variety of problems. My first publ
Recent developments in information systems technologies have resulted in computerizing many applications in various business areas. Data has become a critical resource in many organizations, and therefore, ef cient access to data, sharing the data, extracting information from the data, and making use of the information has become an urgent need. As a result, there have been many efforts on not only integrating the various data sources scattered across several sites, but extracting infor- mation from these databases in the form of patterns and trends and carrying out data analytics has also become important. These data sources may be databases managed by database management systems, or they could be data warehoused in a repository from multiple data sources. The advent of the World Wide Web in the mid-1990s has resulted in even greater demand for managing data, information, and knowledge effectively. During this period, the services paradigm was conceived which has now evolved into providing computing infrastructures, software, data- bases, and applications as services. Such capabilities have resulted in the notion of cloud computing. Over the past 5 years, developments in cloud computing have exploded and we now have several companies providing infrastructure software and application computing platforms as services. As the demand for data and information management increases, there is also a critical need for maintaining the security of the databases, applications, and information systems. Data, informa- tion, applications, the web, and the cloud have to be protected from unauthorized access as well as from malicious corruption. The approaches to secure such systems have come to be known as cyber security. The signi cant developments in data management and analytics, web services, cloud computing, and cyber security have evolved into an area called big data management and analytics (BDMA) as well as big data security and privacy (BDSP). The U.S. Bureau of Labor and Statistics de nes big data as a collection of large datasets that cannot be analyzed with normal statistical methods. The datasets can represent numerical, textual, and multimedia data. Big data is popularly de ned in terms of ve Vs: volume, velocity, variety, veracity, and value. BDMA requires handling huge volumes of data, both structured and unstructured, arriving at high velocity. By harnessing big data, we can achieve breakthroughs in several key areas such as cyber security and healthcare, resulting in increased productivity and pro tability. Not only do the big data systems have to be secure, the big data analytics have to be applied for cyber security applications such as insider threat detection. This book will review the developments in topics both BDMA and BDSP and discuss the issues and challenges in securing big data as well as applying big data techniques to solve problems. We will focus on a speci c big data analytics technique called stream data mining as well as approaches to applying this technique to insider threat detection. We will also discuss several experimental systems, infrastructures and education programs we have developed at The University of Texas at Dallas on both BDMA and BDSP. We have written two series of books for CRC Press on data management/data mining and data security. The rst series consist of 10 books. Book #1 (Data Management Systems Evolution and Interoperation) focused on general aspects of data management and also addressed interoperability and migration. Book #2 (Data Mining: Technologies, Techniques, Tools, and Trends) discussed data mining. It essentially elaborated on Chapter 9 of Book #1. Book #3 (Web Data Management and Electronic Commerce) discussed web database technologies and discussed e-commerce as an application area. It essentially elaborated on Chapter 10 of Book #1. Book #4 (Managing and Mining Multimedia Databases) addressed both multimedia database management and multimedia data mining. It elaborated on both Chapter 6 of Book #1 (for multimedia database management) xxiii xxiv Preface and Chapter 11 of Book #2 (for multimedia data mining). Book #5 (XML, Databases and the Semantic Web) described XML technologies related to data management. It elaborated on Chapter 11 of Book #3. Book #6 (Web Data Mining and Applications in Business Intelligence and Counter- terrorism) elaborated on Chapter 9 of Book #3. Book #7 (Database and Applications Security) examined security for technologies discussed in each of our previous books. It focuses on the tech- nological developments in database and applications security. It is essentially the integration of Information Security and Database Technologies. Book #8 (Building Trustworthy Semantic Webs) applies security to semantic web technologies and elaborates on Chapter 25 of Book #7. Book #9 (Secure Semantic Service-Oriented Systems) is an elaboration of Chapter 16 of Book #8. Book #10 (Developing and Securing the Cloud) is an elaboration of Chapters 5 and 25 of Book #9. Our second series of books at present consists of four books. Book #1 is Design and Implementation of Data Mining Tools. Book #2 is Data Mining Tools for Malware Detection. Book #3 is Secure Data Provenance and Inference Control with Semantic Web. Book #4 is Analyzing and Securing Social Networks. Book #5, which is the current book, is Big Data Analytics with Applications in Insider Threat Detection. For this series, we are converting some of the practical aspects of our work with students into books. The relationships between our texts will be illus- trated in Appendix A. ORGANIZATION OF THIS BOOK This book is divided into ve parts, each describing some aspect of the technology that is relevant to BDMA and BSDP. The major focus of this book will be on stream data analytics and its applica- tions in insider threat detection. In addition, we will also discuss some of the experimental systems we have developed and provide some of the challenges involved. Part I, consisting of six chapters, will describe supporting technologies for BDMA and BDSP including data security and privacy, data mining, cloud computing and semantic web. Part II, consisting of six chapters, provides a detailed overview of the techniques we have developed for stream data analytics. In particular, we will describe our techniques on novel class detection for data streams. Part III, consisting of nine chapters, will discuss the applications of stream analytics for insider threat detection. Part IV, consisting of six chapters, will discuss some of the experimental systems we have developed based on BDMA and BDSP. These include secure query processing for big data as well as social media analysis. Part V, consisting of seven chapters, discusses some of the challenges for BDMA and BDSP. In particular, securing the Internet of Things as well as our plans for developing experimental infrastructures for BDMA and BDSP are also discussed. DATA, INFORMATION, AND KNOWLEDGE In general, data management includes managing the databases, interoperability, migration, ware- housing, and mining. For example, the data on the web has to be managed and mined to extract information and patterns and trends. Data could be in les, relational databases, or other types of databases such as multimedia databases. Data may be structured or unstructured. We repeatedly use the terms data, data management, and database systems and database management systems in this book. We elaborate on these terms in the appendix. We de ne data management systems to be systems that manage the data, extract meaningful information from the data, and make use of the information extracted. Therefore, data management systems include database systems, data ware- houses, and data mining systems. Data could be structured data such as those found in relational databases, or it could be unstructured such as text, voice, imagery, and video. There have been numerous discussions in the past to distinguish between data, information, and knowledge. In some of our previous books on data management and mining, we did not attempt to clarify these terms. We simply stated that, data could be just bits and bytes or it could convey some meaningful information to the user. However, with the web and also with increasing interest in data, Preface xxv information and knowledge management as separate areas, in this book we take a different approach to data, information, and knowledge by differentiating between these terms as much as possible. For us data is usually some value like numbers, integers, and strings. Information is obtained when some meaning or semantics is associated with the data such as John’s salary is 20K. Knowledge is something that you acquire through reading and learning, and as a result understand the data and information and take actions. That is, data and information can be transferred into knowledge when uncertainty about the data and information is removed from someone’s mind. It should be noted that it is rather dif cult to give strict de nitions of data, information, and knowledge. Sometimes we will use these terms interchangeably also. Our framework for data management discussed in the appendix helps clarify some of the differences. To be consistent with the terminology in our previ- ous books, we will also distinguish between database systems and database management systems. A database management system is that component which manages the database containing persistent data. A database system consists of both the database and the database management system. FINAL THOUGHTS The goal of this book is to explore big data analytics techniques and apply them for cyber secu- rity including insider threat detection. We will discuss various concepts, technologies, issues, and challenges for both BDMA and BDSP. In addition, we also present several of the experimental systems in cloud computing and secure cloud computing that we have designed and developed at The University of Texas at Dallas. We have used some of the material in this book together with the numerous references listed in each chapter for graduate level courses at The University of Texas at Dallas on “Big Data Analytics” as well on “Developing and Securing the Cloud.” We have also provided several experimental systems developed by our graduate students. It should be noted that the eld is expanding very rapidly with several open source tools and commercial products for managing and analyzing big data. Therefore, it is important for the reader to keep up with the developments of the various big data systems. However, security cannot be an afterthought. Therefore, while the technologies for big data are being developed, it is important to include security at the onset.
The world generates data at an increasing pace. Consumers, sensors, or scienti c experiments emit data points every day. In nance, business, administration and the natural or social sciences, working with data can make up a signi cant part of the job. Being able to ef ciently work with small or large datasets has become a valuable skill. Python started as a general purpose language. Around ten years ago, in 2006, the rst version of NumPy was released, which made Python a rst class language for numerical computing and laid the foundation for a prospering development, which led to what we today call the PyData ecosystem: A growing set of high- performance libraries to be used in the sciences, nance, business or anywhere else you want to work ef ciently with datasets. Python is not only about data analysis. The list of industrial-strength libraries for many general computing tasks is long, which makes working with data in Python even more compelling. Social media and the Internet of Things have resulted in an avalanche of data. The data is powerful but not in its raw form; it needs to be processed and modeled and Python is one of the most robust tools we have out there to do so. It has an array of packages for predictive modeling and a suite of IDEs to choose from. Learning to predict who would win, lose, buy, lie, or die with Python is an indispensable skill set to have in this data age. This course is your guide to get started with Predictive Analytics using Python as the tool. Data visualization is intended to provide information clearly and help the viewer understand them qualitatively. The well-known expression that a picture is worth a thousand words may be rephrased as “a picture tells a story as well as a large collection of words”. Visualization is, therefore, a very precious tool that helps the viewer understand a concept quickly. We are currently faced with a plethora of data containing many insights that hold the key to success in the modern day. It is important to nd the data, clean it, and use the right tool to visualize it. This course explains several different ways to visualize data using Python packages, along with very useful examples in many different areas such as numerical computing, nancial models, statistical and machine learning, and genetics and networks.
"Place sign in" 错误通常出现在使用 Spring Security 进行身份验证的应用程序中。这通常意味着用户没有通过身份验证并且没有正确的会话信息。可能的原因是在使用 HttpSession 时,没有正确地配置 Spring Security。 为了解决这个问题,你可以尝试以下步骤: 1. 确保在 Spring Security 配置中启用了会话管理: ```java @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.ALWAYS); } } ``` 2. 确保使用 Spring Security 进行身份验证时,正确地配置了 HttpSession: ```java @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.ALWAYS) .and() .formLogin() .loginPage("/login") .permitAll() .and() .logout() .logoutSuccessUrl("/") .permitAll() .and() .authorizeRequests() .antMatchers("/admin/**").hasRole("ADMIN") .anyRequest().authenticated(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth .inMemoryAuthentication() .withUser("user").password("password").roles("USER") .and() .withUser("admin").password("password").roles("USER", "ADMIN"); } } ``` 3. 确保在使用 HttpSession 时,正确地配置了 Spring Boot 的属性: ```properties # application.properties server.servlet.session.timeout=30m ``` 如果你仍然遇到问题,可能需要进一步检查你的代码和配置是否正确。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值