题目链接:
Java代码如下:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
long a= scanner.nextLong();
long b=scanner.nextLong();
long n= scanner.nextLong();
System.out.println(getResult(a,b,n));
}
public static long getResult(long a,long b,long n){
long count=0;
boolean flag=false;
long t=5a+2b;
long c=n/t;
n=n%t;
count=7*c;
while (n>0 && flag==false){
for (int i = 1; i <= 5; i++) {
if(n>0){
n=n-a;
count++;
}else{
flag=true;
break;
}
}
for (int i = 1; i <= 2; i++) {
if (n>0){
n=n-b;
count++;
}else {
flag=true;
break;
}
}
}
return count;
}
}