Havard University acadamic school european sta
package com.microsoft.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class MicrosoftAcadamicController {
public static void main(String[] args) {
System.out.println("Hello World!");
List<Integer> intList=new ArrayList<Integer>();
String sTestStr=angryProfessor(3,intList);
System.out.println(sTestStr);
List<Integer> intList1=new ArrayList<Integer>();
String sTestStr1=angryProfessor(2,intList1);
System.out.println(sTestStr1);
}
public static String angryProfessor(int k, List<Integer> a) {
String retFlag=angryProfessor1(k,a);
if(retFlag.equals("NO")) {
return "YES";
}else if(retFlag.equals("YES")) {
return "NO";
}
return "YES";
}
/**
* Havard University acadamic school european station angryProfessor
* needs:
* european college students is very strict acadamic class lectrue timeline check in and check out rule
* some American students foreign role is very lazy
* so do this survey system generate a report weather this project class need be withdraw or keep on moving cs education
* inputs k means students representation lazy key unit line is 3 units red line
* one lazy unit check in class deadline is 100 millionseconds
* N is experied line timestamp concurrent milliseconds
* constraints:
* 1<N<=1000
* constraint :
* 1<k<10
* parameter list a is American students time deadline lazy time unit added some negative lazy tag list
* 1<a<10
* need be statistics:
* sumlation is compute total time lazy time unint is if can't undstand represention student accpted key lazy time unit
* example:
* 2 //2 line inputs
* 4 3 // 4 is a means American students tag time units some lazy time uints record . 3 means this is key deadline readline lazy
* // time uints
* -1 -3 4 2 // output: false "NO" test reality is another status "YES"
* 4 2
* 0 -1 2 1 // output: true "YES" test reality is another status "NO"
* @param k
* @param a
* @return
*/
public static String angryProfessor1(int k, List<Integer> a) {
String firstVersionDataParameterCheck=dataCheckedVersionForNormalParameterV1(k,a);
if(firstVersionDataParameterCheck.equals("NO")) {
return "NO";
}
if(a.size()==1) {
String valRet=dataCheckedVersionForRedImageOfRepresentitonV0(k,a);
if(valRet.equals("NO")) {
return "NO";
}
return "YES";
}
if(a.size()==2) {
String valRet=dataCheckedVersionForRedImageOfRepresentitonV1(k,a);
if(valRet.equals("NO")) {
return "NO";
}
return "YES";
}
// index is great than 3 member size version -> if first version check is not passed
// else come this version
String retDataStatusV3=dataCheckedVersionForRedImageOfRepresentitonV3(k,a);
if(retDataStatusV3.equals("NO")) {
return "NO";
}else if(retDataStatusV3.equals("YES")) {
return "YES";
}
return "YES";
}
/**
* data convert to oop design
* @param k
* @param a
* @return
*/
public static List<CustLazyStudentsStatistics> dataCovert2OOPDesign(int k, List<Integer> a){
String retVal=dataCheckedVersionForNormalParameterV1(k,a);
if(retVal.equals("NO")) {
return null;
}
List<CustLazyStudentsStatistics> custLazyStudentsStatisticsList=new ArrayList<CustLazyStudentsStatistics>();
for (int i = 0; i < a.size(); i++) {
CustLazyStudentsStatistics custLazyStudentsStatistics=new CustLazyStudentsStatistics();
custLazyStudentsStatistics.setId(UUID.randomUUID().toString());
custLazyStudentsStatistics.setName("");
custLazyStudentsStatistics.setRepresentationAcceptedLazyTimeUnits(k);
custLazyStudentsStatistics.setProfessorAngryLazyTag(a.get(i)+"");
custLazyStudentsStatisticsList.add(custLazyStudentsStatistics);
}
return custLazyStudentsStatisticsList;
}
/**
* !(index is 0 and 1 list size version ->first version check)
* version 3. 0 data check version for red image of representation
* data checked for American Students Lazy time uints tagged with red image false status
* @param k
* @param a
* @return
*/
public static String dataCheckedVersionForRedImageOfRepresentitonV3(int k, List<Integer> a) {
String firstVersionDataParameterCheck=dataCheckedVersionForNormalParameterV1(k,a);
if(firstVersionDataParameterCheck.equals("NO")) {
return "NO";
}
if(a.size()<=2) {
return "NO";
}
// index is 0 and 1 list size version ->first version check
String retDataStatus=dataCheckedVersionForRedImageOfRepresentitonV1(k,a);
if(retDataStatus.equals("NO")) {
return "NO";
}
// index is great than 3 member size version -> if first version check is not passed
// else come this version
List<CustLazyStudentsStatistics> custLazyStudentsStatisticsList=dataCovert2OOPDesign(k,a);
Boolean redLineImageOfRepresentationCopy=false;
for (int i = 0; i < custLazyStudentsStatisticsList.size(); i++) {
CustLazyStudentsStatistics e1=custLazyStudentsStatisticsList.get(i);
String retFlag=dataCheckedVersionForRedImageOfRepresentitonV0(k, a);
if(retFlag.equals("NO")) {
return "NO";
}else if(retFlag.equals("YES")) {
return "YES";
}
if((i++)==(custLazyStudentsStatisticsList.size()-1)) {
String retFlag1=dataCheckedVersionForRedImageOfRepresentitonV1(k, a);
if(retFlag1.equals("NO")) {
return "NO";
}else if(retFlag1.equals("YES")) {
return "YES";
}
}
CustLazyStudentsStatistics e2=custLazyStudentsStatisticsList.get(i+1);
String arg0StrProfessorAngryTag=e1.getProfessorAngryLazyTag();
int intValArg0StrProfessorAngryTag=Integer.valueOf(arg0StrProfessorAngryTag);
String arg1StrProfessorAngryTag=e2.getProfessorAngryLazyTag();
int intValArg1StrProfessorAngryTag1=Integer.valueOf(arg1StrProfessorAngryTag);
int wrongImageReprsentation2AStuCount=0;
if(intValArg0StrProfessorAngryTag<=0) {
wrongImageReprsentation2AStuCount++;
}
if(intValArg1StrProfessorAngryTag1<=0) {
wrongImageReprsentation2AStuCount++;
}
Boolean redLineImageOfReprsentation=false;
if(wrongImageReprsentation2AStuCount>=k) {
redLineImageOfReprsentation=true;
}
redLineImageOfRepresentationCopy=redLineImageOfReprsentation;
}
if(redLineImageOfRepresentationCopy) {
return "YES";
}
return "YES";
}
/**
* index is 0 list size version ->root version check
* data checked for American Students Lazy time uints tagged with red image false status
* @param k
* @param a
* @return
*/
public static String dataCheckedVersionForRedImageOfRepresentitonV0(int k, List<Integer> a) {
String retFlag=dataCheckedVersionForNormalParameterV1(k,a);
if(retFlag.equals(retFlag)) {
return "NO";
}
List<CustLazyStudentsStatistics> custLazyStudentsStatisticsList=dataCovert2OOPDesign(k,a);
if(custLazyStudentsStatisticsList.size()>1) {
return "NO";
}
// index is 0 list size version ->root version check
CustLazyStudentsStatistics custLazyStudentsStatistics0=custLazyStudentsStatisticsList.get(0);
String arg0StrProfessorAngryTag=custLazyStudentsStatistics0.getProfessorAngryLazyTag();
int intValArg0StrProfessorAngryTag=Integer.valueOf(arg0StrProfessorAngryTag);
int wrongImageReprsentation2AStuCount=0;
if(intValArg0StrProfessorAngryTag<=0) {
wrongImageReprsentation2AStuCount++;
}
Boolean redLineImageOfReprsentation=false;
if(wrongImageReprsentation2AStuCount>=k) {
redLineImageOfReprsentation=true;
}
if(redLineImageOfReprsentation) {
return "YES";
}
return "YES";
}
/**
* index is 0 and 1 list size version ->first version check
* data checked for American Students Lazy time uints tagged with red image false status
* @param k
* @param a
* @return
*/
public static String dataCheckedVersionForRedImageOfRepresentitonV1(int k, List<Integer> a) {
String firstVersionDataParameterCheck=dataCheckedVersionForNormalParameterV1(k,a);
if(firstVersionDataParameterCheck.equals("NO")) {
return "NO";
}
List<CustLazyStudentsStatistics> custLazyStudentsStatisticsList=dataCovert2OOPDesign(k,a);
if(custLazyStudentsStatisticsList.size()==2) {
return "NO";
}
// index is 0 and 1 list size version ->first version check
Boolean redLineImageOfRepresentationCopy=false;
for (int i = 0; i < custLazyStudentsStatisticsList.size(); i++) {
CustLazyStudentsStatistics custLazyStudentsStatistics0=custLazyStudentsStatisticsList.get(0);
CustLazyStudentsStatistics custLazyStudentsStatistics1=custLazyStudentsStatisticsList.get(1);
String arg0StrProfessorAngryTag=custLazyStudentsStatistics0.getProfessorAngryLazyTag();
int intValArg0StrProfessorAngryTag=Integer.valueOf(arg0StrProfessorAngryTag);
String arg1StrProfessorAngryTag=custLazyStudentsStatistics1.getProfessorAngryLazyTag();
int intValArg1StrProfessorAngryTag1=Integer.valueOf(arg1StrProfessorAngryTag);
int wrongImageReprsentation2AStuCount=0;
if(intValArg0StrProfessorAngryTag<=0) {
wrongImageReprsentation2AStuCount++;
}
if(intValArg1StrProfessorAngryTag1<=0) {
wrongImageReprsentation2AStuCount++;
}
Boolean redLineImageOfReprsentation=false;
if(wrongImageReprsentation2AStuCount>=k) {
redLineImageOfReprsentation=true;
}
redLineImageOfRepresentationCopy=redLineImageOfReprsentation;
}
if(redLineImageOfRepresentationCopy) {
return "YES";
}
return "YES";
}
/**
* data checked for normal interface paremeter
* index is great than 3 member size version 1.0 to version 3.0 root check repeated check
* @param k
* @param a
* @return
*/
public static String dataCheckedVersionForNormalParameterV1(int k, List<Integer> a) {
if(k<1 || k>=10) {
return "NO";
}
if(a==null) {
return "NO";
}
if(a.isEmpty()) {
return "NO";
}
int aStudentsSize=a.size();
if(aStudentsSize<1 || aStudentsSize>10) {
return "NO";
}
for (int i = 0; i < a.size(); i++) {
int aIntVal=a.get(i);
if(aIntVal<0) {
String copy2PositiveIntValStr=String.valueOf(aIntVal);
String copy2PostiveIntValStrSubStr=copy2PositiveIntValStr.substring(1);
aIntVal=Integer.valueOf(copy2PostiveIntValStrSubStr);
}
if(aIntVal<0 || aIntVal>10) {
return "NO";
}
}
return "YES";
}
}
// angry professor is hit this leader board master privilege is professor
class CustLazyStudentsStatistics{
private String id;
private String name;
private String professorAngryLazyTag;
private Integer representationAcceptedLazyTimeUnits;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProfessorAngryLazyTag() {
return professorAngryLazyTag;
}
public void setProfessorAngryLazyTag(String professorAngryLazyTag) {
this.professorAngryLazyTag = professorAngryLazyTag;
}
public Integer getRepresentationAcceptedLazyTimeUnits() {
return representationAcceptedLazyTimeUnits;
}
public void setRepresentationAcceptedLazyTimeUnits(Integer representationAcceptedLazyTimeUnits) {
this.representationAcceptedLazyTimeUnits = representationAcceptedLazyTimeUnits;
}
}
class Professor{
private String id;
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
class Student{
private String id;
private String name;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
class ProfessorStudentTeachLog{
private String id;
private String name;
private String professorId;
private String studentId;
private String custLazyStudentsStatisticsId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getProfessorId() {
return professorId;
}
public void setProfessorId(String professorId) {
this.professorId = professorId;
}
public String getStudentId() {
return studentId;
}
public void setStudentId(String studentId) {
this.studentId = studentId;
}
public String getCustLazyStudentsStatisticsId() {
return custLazyStudentsStatisticsId;
}
public void setCustLazyStudentsStatisticsId(String custLazyStudentsStatisticsId) {
this.custLazyStudentsStatisticsId = custLazyStudentsStatisticsId;
}
}
class StudentProfessorTakeLectureLog{
private String id;
private String name;
private String studentId;
private String professorId;
private String custLazyStudentsStatisticsId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStudentId() {
return studentId;
}
public void setStudentId(String studentId) {
this.studentId = studentId;
}
public String getProfessorId() {
return professorId;
}
public void setProfessorId(String professorId) {
this.professorId = professorId;
}
public String getCustLazyStudentsStatisticsId() {
return custLazyStudentsStatisticsId;
}
public void setCustLazyStudentsStatisticsId(String custLazyStudentsStatisticsId) {
this.custLazyStudentsStatisticsId = custLazyStudentsStatisticsId;
}
}
Java技术 文章被收录于专栏
JavaEE技术 编程开发经验 企业通用技术

查看2道真题和解析