1006. Sign In and Sign Out (25)

考察以时间为核心的事件模拟

#include<stdio.h>

typedef struct person
{
	char name[20];
	int in;
	int out;
}Person;


int main()
{
	int m;
	while( scanf("%d", &m) != EOF )
	{
		Person p_in, p_out, tmp;
		int h1, h2, m1, m2, s1, s2;
		char inStr[20];
		char outStr[20];
		if(m == 0) continue;
		scanf("%s%d%*c%d%*c%d %d%*c%d%*c%d", tmp.name, &h1, &m1, &s1, &h2, &m2, &s2);
		tmp.in = h1*3600+m1*60+s1;
		tmp.out = h2*3600+m2*60+s2;
		p_in = p_out = tmp;
		m--;
		while(m--)
		{
			scanf("%s%d%*c%d%*c%d %d%*c%d%*c%d", tmp.name, &h1, &m1, &s1, &h2, &m2, &s2);
			tmp.in = h1*3600+m1*60+s1;
			tmp.out = h2*3600+m2*60+s2;
			if(tmp.in < p_in.in) p_in = tmp;
			if(tmp.out > p_out.out) p_out = tmp;
		}
		printf("%s %s\n", p_in.name, p_out.name);
	}
	return 0;
}


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
"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 ``` 如果你仍然遇到问题,可能需要进一步检查你的代码和配置是否正确。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AI记忆

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值