This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_task_index_at_cycle(jobs, cycle): | |
execution_order = sorted(range(len(jobs)), key=lambda k: (jobs[k], k)) | |
total_time = sum(jobs) | |
cycle = cycle % total_time + 1 if cycle >= total_time else cycle | |
current_time = 0 | |
for job_index in execution_order: | |
current_time += jobs[job_index] | |
if cycle <= current_time: | |
return job_index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_task_index_at_cycle(jobs, dependencies, cycle): | |
"""Finds the index of the task running at the given cycle, considering dependencies. | |
Args: | |
jobs: A list of task durations. | |
dependencies: A list of task dependencies, where -1 indicates no dependency. | |
cycle: The cycle time to check. | |
Returns: | |
The index of the task running at the given cycle, or -1 if no task is running. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ApolloServer, gql } = require("apollo-server"); | |
const { events, locations, participants, users } = require("./data"); | |
const { nanoid } = require("nanoid"); | |
const { | |
ApolloServerPluginLandingPageGraphQLPlayground, | |
} = require("apollo-server-core"); | |
const typeDefs = gql` | |
type event { | |
id: ID! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.LinkedHashMap; | |
import java.util.Scanner; | |
public class Main | |
{ | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Comparator; | |
import java.util.TreeSet; | |
class Book implements Comparable<Book>{ | |
private final String name; | |
private final int pageNumber; | |
private final String author; | |
private final int publishDate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { ApolloServer, gql } = require("apollo-server"); | |
const { events, locations, participants, users } = require("./data"); | |
const typeDefs = gql` | |
type event { | |
id: ID! | |
title: String! | |
desc: String! | |
date: String! | |
from: String! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Giris; | |
import java.lang.Math; | |
public class Main { | |
public static void main(String[] args) { | |
Fighter marc = new Fighter("Marc" , 15 , 100, 90, 0); | |
Fighter alex = new Fighter("Alex" , 10 , 95, 100, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Giris; | |
import java.util.Scanner; | |
public class Baslangic { | |
public static void main(String args[]) { | |
Scanner input = new Scanner(System.in); | |
int a, total = 0; | |
do{ | |
System.out.print("Enter a number: "); | |
a = input.nextInt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Giris; | |
import java.util.Scanner; | |
public class Baslangic { | |
public static void main(String args[]) { | |
Scanner scanner=new Scanner(System.in); | |
int sayi1=scanner.nextInt(); | |
for (int i=0;i<=sayi1;i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Giris; | |
import java.util.Scanner; | |
public class Baslangic { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
System.out.print("Yılı Giriniz: " ); | |
int yil=scanner.nextInt(); | |
if(yil%4==0) { |
NewerOlder